RFC 768 - User Datagram Protocol (UDP)
Abstract
This User Datagram Protocol (UDP) is defined to make available a datagram mode of packet-switched computer communication in the environment of an interconnected set of computer networks. This protocol assumes that the Internet Protocol (IP) is used as the underlying protocol.
Protocol Overview
UDP provides a procedure for application programs to send messages to other programs with a minimum of protocol mechanism. The protocol is transaction oriented, and delivery and duplicate protection are not guaranteed.
Key Characteristics
- Connectionless: No connection establishment required
- Unreliable: No delivery guarantees or error recovery
- Fast: Minimal overhead compared to TCP
- Simple: Basic header structure with minimal fields
UDP Header Format
0 7 8 15 16 23 24 31
+--------+--------+--------+--------+
| Source | Destination |
| Port | Port |
+--------+--------+--------+--------+
| | |
| Length | Checksum |
+--------+--------+--------+--------+
|
| data octets ...
+---------------- ...
Header Fields
- Source Port (16 bits): Optional field identifying the sender's port
- Destination Port (16 bits): Port number for the destination application
- Length (16 bits): Length of UDP header and data in octets
- Checksum (16 bits): Optional checksum for error detection
Common Applications
Real-time Communications
- Voice over IP (VoIP)
- Video streaming
- Online gaming
- WebRTC data channels
Network Services
- DNS queries
- DHCP
- SNMP
- NTP (Network Time Protocol)
Modern Protocols
- QUIC (HTTP/3)
- WebRTC
- IoT communications
- Microservices messaging
UDP vs TCP Comparison
| Feature | UDP | TCP |
|---|---|---|
| Connection | Connectionless | Connection-oriented |
| Reliability | Unreliable | Reliable |
| Ordering | No ordering | Ordered delivery |
| Speed | Fast | Slower (more overhead) |
| Header Size | 8 bytes | 20+ bytes |