UDP - User Datagram Protocolprotocol description, packet/header structure and more
2005-05-30 (updated: 2009-11-09) by Philip
Tags: UDP, packet, header, checksum, protocol, TCP/IP
The User Datagram Protocol (UDP) is one of the core Internet protocols. UDP is lightweight, faster and more efficient for many purposes, however it does not guarantee packets will arrive at the destination, does not provide some of the TCP guarantees, such as packet retransmission, ordering, etc. Common network applications that use UDP include DNS, SNMP, DHCP, RIP, streaming media applications, Voice over IP, TFTP, and online games.
UDP is a stateless connectionless transport protocol, offering only minimal transport layer service. It does not guarantee packet delivery, it only adds multiplexing by port number and a checksum. Unlike TCP, UDP does not handle retransmission of packets, packetization and reassembly, flow control, congestion avoidance, etc.
UDP Header structure
Source port - 16 bits (optional)
Port number of the sender. Should be zero if not used. Should be assumed to be the port to reply to if needed.
Destination port - 16 bits
The destination port this packet is addressed to. This field is required.
Length - 16 bits
The length in bytes of the UDP header and encapsulated data.
Checksum - 16 bits (optional)
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 (as needed) with zero bytes at the end to make a multiple of two bytes. The checksum is not optional when transported by IPv6.
Data - variable length