UDP

UDP (User Datagram Protocol) is a connectionless transport protocol. “UDP provides a way for applications to send encapsulated IP datagrams without having to establish a connection” [1, P. 541].

UDP does not provide protection against lost packets. It’s the responsibility of application-layer protocols, like QUIC and DNS, to manage packet retransmission.

Table of contents

  1. The UDP protocol
  2. Uses of UDP
  3. References

The UDP protocol

UDP sends segments containing an 8-byte header, followed by the payload data.


                  0      7 8     15 16    23 24    31
                 +--------+--------+--------+--------+
                 |     Source      |   Destination   |
                 |      Port       |      Port       |
                 +--------+--------+--------+--------+
                 |                 |                 |
                 |     Length      |    Checksum     |
                 +--------+--------+--------+--------+
                 |
                 |          data octets ...
                 +---------------- ...

[2, P. 1]

The Source Port and Destination Port fields specify the port of the sending and receiving processes respectively.

The Length field is the total length of the datagram (in octets), including both the 8-byte header and the data.

The Checksum field “is the 16-bit one’s complement of the one’s complement sum of a pseudo header of information from the IP header, the UDP header, and the data, padded with zero octets at the end (if necessary) to make a multiple of two octets” [2, P. 2].

Uses of UDP

The main value of UDP over raw IP is the addition of source and destination ports.

UDP is a simple protocol that can be used as a building block for other protocols, like QUIC (soon to become the HTTP3 protocol).

UDP is also used for most DNS queries.

References

  1. [1] A. Tanenbaum and D. Wetherall, Computer Networks, 5th ed. 2011.
  2. [2] “User Datagram Protocol,” no. 768. RFC Editor, Aug-1980.