Back to Transport Layer
UDP Protocol
User Datagram Protocol - Connectionless transport layer protocol
Protocol Type
Connectionless, unreliable transport
Header Size
8 bytes - minimal overhead
Use Cases
DNS, DHCP, gaming, streaming
UDP Packet Simulator
UDP Header Structure
Source Port
16 bits
Destination Port
16 bits
Length
16 bits
Checksum
16 bits
Data (Variable Length)
Application data payload
TCP vs UDP Comparison
| Feature | TCP | UDP | Better For |
|---|---|---|---|
| Connection Setup | 3-way handshake required | No connection setup | UDP |
| Reliability | Guaranteed delivery | Best effort | TCP |
| Speed | Slower due to overhead | Faster transmission | UDP |
| Header Size | 20+ bytes | 8 bytes | UDP |
| Flow Control | Built-in flow control | No flow control | TCP |
| Error Detection | Error detection & correction | Basic checksum only | TCP |
| Use Case | File transfer, web browsing | Gaming, streaming, DNS | Depends |
| Overhead | High overhead | Low overhead | UDP |
UDP Characteristics
Advantages
- • Fast transmission (no connection setup)
- • Low overhead (8-byte header)
- • Simple protocol implementation
- • Suitable for real-time applications
- • Supports broadcast/multicast
- • No connection state maintenance
Disadvantages
- • No guarantee of delivery
- • No ordering of packets
- • No flow control mechanism
- • No congestion control
- • Limited error detection
- • Application must handle reliability
Common UDP Use Cases
DNS (Domain Name System)
Quick name resolution queries where speed matters more than reliability
Online Gaming
Real-time multiplayer games requiring low latency over reliability
Video Streaming
Live video/audio streams where occasional packet loss is acceptable
DHCP
Dynamic Host Configuration Protocol for IP address assignment
SNMP
Simple Network Management Protocol for network monitoring
NTP
Network Time Protocol for clock synchronization across networks