Appearance
TCP & UDP: Reliable vs Fast
Season 2 · Note 6
In Plain English (30-Second Refresher)
TL;DR
Two delivery styles sit on top of IP (Internet Protocol):
- TCP (Transmission Control Protocol): reliable. A three-message handshake first (SYN, short for synchronize → SYN-ACK → ACK), then numbered pieces, receipts (ACKs, acknowledgements), and resending until everything arrives complete and in order. It also slows down when the network is busy. Used for web pages, files and your score.
- UDP (User Datagram Protocol): fast. No handshake, no receipts, no resends. Lost pieces stay lost. Used when the newest data matters more than every piece: live games, voice and video calls.
- Both use ports (443, 53, …) to say which app a packet is for.
The Mission We Follow
Two Coin Dash jobs: save your score (every digit must arrive) and race a friend live (their position must arrive now). Same internet, two delivery styles.
Real-World Analogy: Registered Mail vs Shouting 📮
| In real life | In networking | What it does |
|---|---|---|
| 📞 "Hello?" "Hi, can you hear me?" "Yes!" | TCP handshake | Agree before talking |
| 📄 Numbered pages | Sequence numbers | Spot gaps, rebuild in order |
| 🧾 Delivery receipts | ACKs | Tell the sender what arrived |
| 🔁 Re-posting a missing page | Retransmission | Fill the gaps |
| 🚦 Driving slower in traffic | Congestion control | Share the road fairly |
| 📣 Shouting across the street | UDP | Fast, no guarantees |
| 🚪 Room number | Port | Which app gets it |
Visual Mental Model
How It Works (Interactive Animated Flow)
Reliable vs Fast
Your score over TCP, your live race over UDP
🎯 Mission Deliver “score = 52” completely and in order, even if a piece is lost.
Congestion control in one line
TCP sends a little, then doubles every round trip (slow start) until a packet is lost, then halves and grows gently. That's why downloads "ramp up", and why millions of connections can share one cable without collapse.
Side by Side
| TCP | UDP | |
|---|---|---|
| Setup | 3-way handshake (1 round trip) | none |
| Delivery | guaranteed, in order | best effort |
| Lost packet | resent | gone |
| Speed control | congestion control | none (the app decides) |
| Header size | 20+ bytes | 8 bytes |
| Typical uses | web, files, email, your score | live games, voice/video calls, DNS (Domain Name System) lookups |
Common ports
| Port | Used by |
|---|---|
| 443 | secure web (HTTPS, HyperText Transfer Protocol Secure) |
| 80 | plain web (HTTP) |
| 53 | DNS |
| 22 | remote login (SSH, Secure Shell) |
Plot Twist: QUIC
The newest web version, HTTP/3, runs on QUIC, a transport built on UDP that adds its own numbering, resending and encryption. It starts faster than TCP + TLS (Transport Layer Security) and doesn't stall every stream when one packet is lost.
Trade-offs
| Choice | Upside | Downside |
|---|---|---|
| TCP | Complete, ordered data with no app effort | Handshake delay; one lost piece holds up the rest (head-of-line blocking) |
| UDP | Lowest delay; app stays in control | The app must cope with loss and order itself |
| QUIC | TCP-like reliability, faster start | Newer; some networks block or slow UDP |
Common Gotchas
Watch Out For
- "UDP is unreliable" ≠ "UDP is bad". For live data, late is worse than lost.
- TCP guarantees delivery to the other computer, not that the app processed it. Apps still send their own "saved ✓" replies (like HTTP 200 OK).
- A new connection is slow at first (handshake + slow start). Reusing connections makes pages load faster.
- Ports are per protocol: TCP port 53 and UDP port 53 are different doors.
Quick Self-Check (Restore Your Memory)
1. Which should carry your saved score, and why?
TCP: every piece must arrive, in order. It resends anything lost.
2. One update in a live race is lost. What should the game do?
Nothing: use the next update, which arrives milliseconds later. That's why games use UDP.
3. What are the three messages of the TCP handshake?
SYN ("let's talk, I number from X") → SYN-ACK ("OK, I number from Y") → ACK ("great"). Then data flows.
🎬 Now Watch It Happen
2-minute episode
Ride along as the packet through a handshake, a lost piece and a resend, then switch to a live race. S2 · E6 — Reliable or Fast →