Definition:
- UDP is a transport-layer protocol providing connectionless, unreliable, unordered datagram delivery
- ”Fire and forget”: no handshake, no acknowledgements, no retransmission
- Used when latency matters more than correctness: DNS, DHCP, VoIP, video streaming, online games, QUIC
Connectionless:
- No handshake — a host just sends datagrams to a destination address/port
- No connection state is kept on either side
Unreliable (best-effort):
- No guarantee of delivery, ordering, or de-duplication
- No retransmission — lost packets stay lost (the application must handle it if it cares)
- Has a checksum (optional in IPv4) for corruption detection only
Why use it:
- Low overhead: 8-byte header vs TCP’s 20–60
- No handshake latency, no head-of-line blocking
- The application can build its own reliability on top — this is exactly what QUIC does over UDP
TCP vs UDP:
- Connection: TCP connection-oriented (handshake) ; UDP connectionless
- Reliability: TCP guaranteed + ordered ; UDP best-effort, may drop / reorder
- Speed: TCP slower (more overhead) ; UDP faster (minimal overhead)
- Header size: TCP 20–60 B ; UDP 8 B
- Flow / congestion control: TCP yes ; UDP none
- Use case: TCP web / email / SSH ; UDP DNS / streaming / gaming / VoIP
- See Transmission Control Protocol