Federico Mengozzi

Transport Layer

Connectionless Transport: UDP

UDP takes messages from the application process, attaches source and destination port number fields for the multiplexing/demultiplexing service, adds two other small fields, and passes the resulting segment to the network layer

UDP can be choose over TCP for the following reasons:

  • Finer application-level control over the sent data - Real-time applications often require a minimum sending rate, do not want to overly delay segment transmission, and can tolerate some data loss
  • No connection establishment - UDP just blasts away without any formal preliminaries getting rid of set up delay
  • No connection state - By not maintaining a connection state a server can typically support many more active clients when the application runs over UDP rather than TCP
  • Small packet header overhead - The TCP segment has 20 bytes of header overhead in every segment, whereas UDP has only 8 bytes of overhead

UDP Segment Structure

The UDP segment has five field of data

32 bits
source portdestination port
data lengthchecksum
data

UDP Checksum

The UDP checksum is used to check for data corruption. It’s created by calculating the $1s$ complement of the sum of all 16 bit word in the segment (with the overflow carried around). On the receiving side, to check for data integrity is sufficient to sum this checksum with the sum of all 16 bit word in the segment, for the data to be not altered the result should be 1111111111111111.

UDP use no mechanism for error recovering, if the data is corrupted some application might just discard it or accept it anyway with a warning.

Go to top