The Transport Layer

UDP

/ you-dee-pee /

UDP is the postcard of the Internet. You write a short message, drop it in the box, and it usually arrives — but there is no tracking, no proof of delivery, and if two postcards arrive out of order or one gets lost, nobody resends it. UDP is a deliberately thin, no-frills transport: it adds almost nothing to what the network layer already does, and it makes no promises beyond best effort.

Mechanically, UDP wraps your data in a tiny 8-byte header containing just four fields: source port, destination port, length, and checksum. That is it. It does not establish a connection (it is connectionless), does not number bytes, does not acknowledge or retransmit, and does not control its sending rate. The checksum lets the receiver detect (but not fix) corruption, and a corrupted datagram is simply discarded. Each UDP datagram is independent — it either arrives whole or not at all, with no ordering guarantee relative to others.

Why it matters: UDP is not 'broken TCP' — it is the right tool when an application prefers timeliness and control over guaranteed, in-order delivery. DNS uses it because one quick query-and-reply is cheaper than a full connection. Live voice and video (VoIP, conferencing) use it because a packet that arrives late is useless anyway — better to skip it than to stall the whole stream waiting for a retransmission. Online games use it for the same reason. Apps that want reliability on top of UDP must build it themselves (as QUIC does). The honest caveat: UDP has no congestion control, so a misbehaving UDP flood can crowd out well-behaved traffic — responsible UDP apps add their own rate control.

When you type a domain into your browser, your machine usually fires off a single small UDP datagram to a DNS server on port 53 and gets one back. If it's lost, the resolver just asks again — far cheaper than the three-way handshake a TCP connection would need.

DNS: one tiny query, one reply — no connection setup needed.

Misconception: 'UDP is unreliable so it's bad.' UDP is a feature, not a defect — it trades guarantees for low latency and simplicity. Apps that need reliability either use TCP or layer their own scheme over UDP.

Also called
User Datagram Protocol使用者資料報協定用戶資料報協定