Skip to main content

UDP segment structure

Short answer

UDP segment has an 8-byte fixed header: source port, destination port, length, and checksum. The checksum covers a pseudo-header, UDP header, and data for error detection. No connection setup, retransmission, or flow control; message boundaries are preserved. Used by DNS, DHCP, and real-time applications.

Explain the UDP segment structure. Illustrate your answer with appropriate figures.

UDP (User Datagram Protocol, RFC 768) is a simple connectionless transport protocol. It adds only port numbers, length and an optional error check to IP. The unit is called a user datagram.

UDP header (8 bytes fixed)

 0                 15 16                31
+--------------------+--------------------+
|   Source port      | Destination port   |
+--------------------+--------------------+
|   Length           |   Checksum         |
+--------------------+--------------------+
|            Data (application)           |
+-----------------------------------------+
FieldSizeMeaning
Source port16 bitsPort of sender (optional, 0 if unused)
Destination port16 bitsPort of receiving application
Length16 bitsHeader + data in bytes (minimum 8)
Checksum16 bitsCovers header, data and a pseudo-header; optional in IPv4, mandatory in IPv6

Checksum and pseudo-header

The checksum is the 16-bit one's complement of the one's complement sum of a pseudo-header, the UDP header and the data. The pseudo-header is not transmitted; it protects against wrong delivery.

+-------------------------------+
| Source IP address (32)        |
| Destination IP address (32)   |
| Zero (8)| Protocol=17| UDP len|
+-------------------------------+

Encapsulation

[ Ethernet hdr | IP hdr | UDP hdr | Data | trailer ]

UDP data length can be at most 65,535 − 8 = 65,527 bytes (65,507 with the 20-byte IP header).

Features

  • Connectionless, no handshake, no retransmission, no flow or congestion control.
  • Message boundaries preserved. Used by DNS (53), DHCP (67/68), SNMP (161), TFTP (69), RTP and VoIP.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Computer Networks and Security chapter 5 questions →