37 Networking Sol
37 Networking Sol
UDP
Connection-oriented
Reliable transport
Flow control
Connection setup, reliability, flow control, congestion control, timing and throughput guarantee, or security
Congestion control
UDP Services
OSI Transport Layer Provides a thin layer over IP 16-bit port space (distinct from TCP ports) allows multiple recipients on a single host
UDP Services
Unit of Transfer
Datagram (variable length packet) Packet boundaries are preserved when receiving data (a read operation yields packet payload as it was originally sent. No guaranteed delivery Drops packets silently No guarantee of maintained order of delivery No flow control
Postal Mail
Unreliable
Unreliable Not necessarily in-order Letters sent independently Must address each reply
Unordered
Unlimited Transmission
Quiz: by locking at UDP packet structure, can you guess what services are provided by UDP?
bits
0-15
0 32 64
UDP provides
application multiplexing (via port numbers) integrity verification (via checksum) of the header and payload packets are sent individually and error checked only if they arrive if any kind of transmission reliability is needed, it must be implemented at application level bits 0-15 16-31 Destination port Checksum
0 32 64
Why should I use UDP? After all, TCP is a better algorithm! Reliability of TCP comes with some costs
TCP needs 3 packets to set up a connection UDP header has 8 bytes instead of 20 (like TCP header) UDP is a better choice for interactive (soft real-time) voice and video traffic (like Skype). During real-time streaming, it is better to occasionally lose few packets (slight QoS degradation) rather than introducing large delays if lost packets are retransmitted.
TCP Connections
Byte stream (interpreted by application); packet boundaries cannot be distinguished by application 16-bit port space allows multiple connections on a single host Connection-oriented
TCP Service
In-order delivery
Monitors network and adjusts transmission appropriately Full-Duplex byte stream
Data Transmission
3-Way Handshake
Passive open
Active open
Sequence Numbers
J,K Synchronize (SYN) Acknowledge (ACK) Server listens for connection from client Client initiates connection to server
Message Types
Client
Server
listen
Passive Open
Active Open
Active close
Client
Message Types
3-way handshake is also possible. The sequence is FIN J, ACK J+1 & FIN K (as single packet), ACK K+1
Time flows down
Receiver uses cumulative acknowledgment For example, if host A sends 10 bytes with sequence numbers 100 to 109, then the receiver transmits ACK 110 since next expected byte should have sequence number 110
TCP header
20 bytes 15 16
TCP data
31
Flags
TCP checksum
Port number
A port number identifies the endpoint of a connection A pair <IP address, port number> identifies one endpoint of a connection Two pairs <client IP address, client port number> and <server IP address, server port number> identify a TCP connection
Applications Applications
Ports:
23 80 104 TCP IP
80 16 TCP IP
Ports:
Sequence number is 32 bits long. Each sequence number identifies a byte in the byte stream Initial Sequence Number (ISN) of a connection is set during connection establishment
Acknowledgements are piggybacked A host uses the AckNo field to send acknowledgements. (If AckNo has a valid value, then the ACK flag is set) The AckNo contains the next SeqNo that a host (receiver) expects to receive Example: The acknowledgement for a segment with sequence numbers 0-1500 is AckNo=1501