Networking · Visual Explainer
TCP vs UDP
The concept
TCP builds a connection first and guarantees every byte arrives in order — you pay for that in latency and overhead. UDP just sends — no handshake, no guarantee, no ordering, and that's exactly why it's fast. You pick based on whether a lost packet is a tragedy or an irrelevance.
Key distinctions
| Term | What it means |
|---|---|
| TCP | The 3-way handshake (SYN → SYN-ACK → ACK) establishes sequence numbers; lost segments are retransmitted, order is guaranteed. HTTPS, SSH, email. |
| UDP | A datagram with ports and a checksum, and that's it. If it's lost, nobody at the transport layer notices. DNS, VoIP, video, gaming. |
| Head-of-line blocking | In TCP, one lost segment stalls everything behind it — the problem QUIC was built to solve. |
| The modern twist | HTTP/3 runs over QUIC, which runs over UDP — reimplementing reliability in userspace to escape TCP's blocking. |
Why it matters in practice
The choice is about consequence, not speed for its own sake. A corrupted video segment is worse than a late one; a dropped game position is irrelevant a frame later.