Skip to content

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 lifeIn networkingWhat it does
📞 "Hello?" "Hi, can you hear me?" "Yes!"TCP handshakeAgree before talking
📄 Numbered pagesSequence numbersSpot gaps, rebuild in order
🧾 Delivery receiptsACKsTell the sender what arrived
🔁 Re-posting a missing pageRetransmissionFill the gaps
🚦 Driving slower in trafficCongestion controlShare the road fairly
📣 Shouting across the streetUDPFast, no guarantees
🚪 Room numberPortWhich app gets it

Visual Mental Model ​

TCP versus UDP: TCP shakes hands, sends numbered pieces and resends a lost one after a missing receipt; UDP fires updates without receipts and skips a lost one

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.
CLIENT💻Your laptopCoin Dash1 round trip🤝Handshakeagree on numberingTCP📦Numbered pieces#101 #102 #103SERVER🖥️Coin Dash serversends receiptsUDP🏁Live positions30 a secondSYNSYN-ACK → ACKsendarrive in orderACK: up to #103fire & forget

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 ​

TCPUDP
Setup3-way handshake (1 round trip)none
Deliveryguaranteed, in orderbest effort
Lost packetresentgone
Speed controlcongestion controlnone (the app decides)
Header size20+ bytes8 bytes
Typical usesweb, files, email, your scorelive games, voice/video calls, DNS (Domain Name System) lookups

Common ports ​

PortUsed by
443secure web (HTTPS, HyperText Transfer Protocol Secure)
80plain web (HTTP)
53DNS
22remote 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 ​

ChoiceUpsideDownside
TCPComplete, ordered data with no app effortHandshake delay; one lost piece holds up the rest (head-of-line blocking)
UDPLowest delay; app stays in controlThe app must cope with loss and order itself
QUICTCP-like reliability, faster startNewer; 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 →

Built for clear thinking and fast 2-minute refreshers.