The Plain Picture#
A postcard: you write it, drop it in the box, done. No envelope, no tracking, no confirmation. Usually it arrives. Sometimes it doesn't, or two sent days apart arrive in the wrong order. Nobody tells you.
It's cheap and instant, which is perfect for a quick "wish you were here". It's terrible for sending a contract.
The Real Name#
UDP (User Datagram Protocol) is a transport protocol that adds just ports (and a checksum to detect corrupted data) on top of IP. Each message is a datagram. No connection, no delivery guarantee, no ordering, no slowing down.
The UDP header is only 8 bytes:
┌──────────────┬──────────────────┐ │ source port │ destination port │ │ length │ checksum │ └──────────────┴──────────────────┘
Under the Hood#
When "no guarantees" is exactly right:
| Use | Why UDP fits |
|---|---|
| DNS lookups | one small question, one small answer; if lost, just ask again |
| Video calls, voice | a late packet is useless — better to skip it than wait for a resend |
| Online games | only the latest position matters |
| Streaming metrics | losing a few samples is fine; speed matters |
| QUIC / HTTP/3 | builds its own reliability on top of UDP (Ch 9) |
Any reliability a UDP application needs, it must build itself.
Check yourself
3 questionsWhat does UDP add on top of IP?
Show answerHide answer
Ports and a checksum — almost nothing else.
Why do video calls prefer UDP?
Show answerHide answer
A late (resent) audio or video packet is useless; skipping it is better than waiting.
Is a UDP datagram guaranteed to arrive? In order?
Show answerHide answer
Neither.