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:

  1. Source port number
  2. Destination port number
  3. Length
  4. 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:

  1. 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)
  2. Intermediate corruption possible:
    • Relaying hosts (routers/switches) could corrupt data
    • Memory corruption in intermediate devices
    • No guarantee that lower layer checksums are sufficient
  3. 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