Theo's Corner
dev / irl / thoughts
← Back
tech

Understanding TCP vs UDP

Theo|Jul 2026|~4 min read

Two protocols sit underneath almost everything that happens over a network. Understanding the difference between them explains a lot about why some things are reliable and slow, and other things are fast but occasionally drop data.

TCP — reliable, ordered, slower

TCP (Transmission Control Protocol) guarantees delivery. If a packet gets lost, it's resent. Packets arrive in the order they were sent, even if they didn't arrive over the network in that order — TCP reorders them. There's a handshake before any data flows, and constant acknowledgment traffic to confirm receipt. This reliability costs overhead — TCP is slower than it needs to be for some use cases because of all this checking.

HTTP, HTTPS, SSH, email — all TCP. Anywhere data absolutely must arrive complete and in order, TCP is the right choice.

UDP — fast, unordered, unreliable

UDP (User Datagram Protocol) just sends packets and doesn't check whether they arrived. No handshake, no resending, no guaranteed order. If a packet gets lost, it's just gone — nobody retries it. This sounds worse, and for some use cases it is, but the speed tradeoff is exactly what certain applications need.

TCP is like sending a letter with tracking and delivery confirmation. UDP is like shouting something across a room — fast, but no guarantee it was heard, and no way to know if it wasn't.

Why games use UDP

In a fast-paced multiplayer game, a player's position updates dozens of times a second. If one update packet gets lost, waiting for TCP to detect that and resend it would mean the game briefly freezes waiting for stale data — worse than just moving on to the next, more current update. UDP lets the game skip the lost packet and use the next one instead, which for real-time data is exactly the right tradeoff. This is a big part of why game server hosting deals with UDP traffic specifically — Minecraft, most FPS games, voice chat — all UDP-based for this reason.

Practical implications for hosting

Firewall rules need to account for both — TCP for the web-facing stuff, UDP for game traffic on whatever ports the game server uses. Load balancers handle TCP and UDP differently. And debugging UDP issues is trickier because there's no built-in acknowledgment to check — packet loss on UDP just looks like missing data with no clear error to point at.

QUIC — the newer middle ground

Worth knowing about — QUIC (which HTTP/3 is built on) runs over UDP but adds reliability and ordering back in at the application layer, getting some of TCP's guarantees with lower latency than traditional TCP. It's becoming more common and is worth understanding if you're doing anything with modern web protocols.