UDP (User Datagram Protocol) - Permanent Note
Core Characteristics
Connection-less Transport Protocol
- No connection establishment required before packet transmission
- Simplest transport layer design
- Packets traverse network immediately without handshaking
UDP Header Structure
Minimalist design with only 4 fields:
- Source port number
- Destination port number
- Length
- Checksum
What UDP Does NOT Provide
1. No Reliability Guarantees
- No acknowledgment messages from destination
- No confirmation that packets were received
- Packets may arrive out of order
- Transport layer cannot determine packet ordering (though application layer may implement its own sequencing)
2. No Flow Control
- Sender transmits packets as fast as possible
- No mechanism to match sender speed to receiver capacity
3. No Connection Management
- No connection setup or teardown
- Each datagram is independent
Why UDP Includes End-to-End Checksum
Despite being “connectionless,” UDP includes a checksum for data integrity because:
- Lower layers may not provide data checking:
- IP only has header checksum (no data checksum!)
- Link layer (Layer 2) could have NO error detection (though most do)
- Intermediate corruption possible:
- Relaying hosts (routers/switches) could corrupt data
- Memory corruption in intermediate devices
- No guarantee that lower layer checksums are sufficient
- End-to-end principle:
- Best to verify data integrity at the endpoints
- Cannot rely solely on per-hop checksums
Use Cases
UDP is ideal when:
- Low latency is more important than reliability
- Application handles its own error recovery
- Broadcast/multicast communication needed
- Examples: DNS, streaming media, online gaming, VoIP