The User Datagram Protocol (UDP) is a minimal message-oriented transport layer protocol that is currently documented by IETF RFC 768.
In the TCP/IP model, UDP provides a very simple interface between a network layer below and an application layer above. UDP provides no guarantees for message delivery and a UDP sender retains no state on UDP messages once sent onto the network. UDP adds only application multiplexing and data checksumming on top of an IP datagram.
Application layer | FTP | SMTP | HTTP | ... |
Transport layer | TCP | UDP | ||
Network layer | IP ICMP | ARP | ||
data link layer | Ethernet | Token Ring | FDDI | ... |
The UDP header consists of only 4 header fields of which two are optional. The source and destination port fields are 16 bit fields that identify the sending and receiving process. Since UDP is stateless and a UDP sender may not solicit replies, the source port is optional. If not used, the source port should be set to zero. The port fields are followed by a mandatory length field specified as bytes of the UDP datagram including the data. The minimum value of the length field is 8 (octets). The remaining header field is a 16-bit checksum field covering the header and data. The checksum is also optional, but almost always used in practice.
Lacking reliability, UDP applications must generally be willing to accept some loss, errors or duplication. Some applications such as TFTP may add rudimentary reliability mechanisms into the application layer as needed. Most often, UDP applications do not require reliability mechanisms and may even be hindered by them. Real-time games and streaming multimedia are typical examples of applications that often use UDP. If an application requires a high degree of reliability, a protocol such as the Transmission Control Protocol may be used.
Lacking any congestion avoidance and control mechanisms, network-based mechanisms are required to minimize potential congestion collapse effects of uncontrolled, high rate UDP traffic loads. In other words, since UDP senders cannot detect congestion, network-based elements such as routers using packet queueing and dropping techniques will often be the only tool available to slow down excessive UDP traffic. The Datagram Congestion Control Protocol (DCCP) is being designed as a partial solution to this problem by adding end host congestion control behavior to high-rate UDP streams such as streaming media.
While the total amount of UDP traffic found on a typical network is often on the order of only a few percent, numerous key applications use UDP. These include the Domain Name System (DNS), the simple network management protocol (SNMP), the dynamic host configuration protocol (DHCP) and the Routing Information Protocol (RIP) to name just a few.