Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSC Advanced Unix Programming, Fall 2015

Similar presentations


Presentation on theme: "CSC Advanced Unix Programming, Fall 2015"— Presentation transcript:

1 CSC 552 - Advanced Unix Programming, Fall 2015
Wednesday, September 30 TCP and UDP socket system calls

2 Example code ~parson/UnixSysProg/udptcp.fall2015.zip

3 Transmission Control Protocol / Internet Protocol (TCP/IP)
Pipe-like, connection oriented, virtual circuit protocol. (But, a pipe lives inside one machine’s OS.) Reliable data delivery via sequence numbers, acknowledgments, timeouts, retransmissions TCP/IP has guaranteed order of delivery. There is overhead associated with TCP/IP reliability. Write() data boundaries for sender may differ from read() data boundaries for receiver.

4 TCP/IP Connection Establishment
Server Process Client Process socket() (local endpoint) socket() bind() (IP address + TCP port) listen() (wait for connect) SYN connect() accept() (grant connection request, makes new fd) SYN, ACK read() ACK write() write () ACK read() close() FIN or RST close()

5 User DatagramProtocol / Internet Protocol (UDP/IP)
Discrete, atomic messages from a sender’s sendto() call arrive at a receiver’s recvfrom(). Unreliable data delivery may discard datagrams. UDP has no guaranteed order of delivery. There is minimal overhead with UDP/IP. Sendto() data boundaries for sender do not differ from recvfrom() data boundaries for receiver. Good medium for media streams where dropped datagrams can be ignored.

6 UDP/IP Connectionless Interaction
Server Process Client Process socket() (local endpoint) socket() bind() (IP address + TCP port) recvfrom() sendto() sendto() recvfrom() close() (closes local endpoint) close() (local)


Download ppt "CSC Advanced Unix Programming, Fall 2015"

Similar presentations


Ads by Google