TCP and UDP Protocols
Level 3 · How data travels
How TCP makes sure every packet arrives in order, and why UDP does not bother. Which one web pages, video calls and games use.
Course contentsLesson 6 of 13
Level 1 · Networks and packets
Level 2 · Addresses and ports
Level 3 · How data travels
Level 4 · HTTP, the language of the web
Level 5 · Locked lines and go-betweens
After this lesson you can
- Say what TCP promises
- Explain why UDP is used anyway
- Pick TCP or UDP for a kind of app
11 mincovers 2 glossary entries
Worth reading first: Network Ports, 80 and 443
How TCP and UDP send packets
TCP and UDP are the two common ways to send packets, and they make different promises. TCP makes sure every packet arrives, in order, and sends again any that are lost. UDP just sends and moves on, with no checks. Web pages and email use TCP. Video calls, games and name lookups mostly use UDP.
TCP starts with a short greeting before any data moves. The client says hello, the server answers, and the client confirms. Only then does the data flow. Every packet is numbered, and the far end says which ones it got. A missing number is sent again.
That care has a cost. The greeting takes a round trip before anything useful is sent. And if packet 3 is lost, packets 4 and 5 wait until it arrives again, so the app sees them in order. On a poor line, that waiting shows up as a pause.
UDP has no greeting and no numbers to track. Each packet is sent on its own. If one is lost, nobody asks for it again. That makes UDP faster and lighter, and it suits data that is useless once it is late.
A video call is the clearest case. A piece of sound from half a second ago is no help now. Better to skip it and play the next one than to freeze the whole call while it is sent again. A missing frame in a game is the same.
Some newer systems build their own checks on top of UDP, to get speed without losing data. The newest version of HTTP works this way. It is still UDP underneath, with the care moved into the app.
People often think UDP is unreliable and so worse. It is a choice, not a fault. For a file, a web page or a payment, every byte matters, and TCP is right. For live sound and play, a late byte is a useless byte, and UDP is right.
Which one to pick
Worked example
A game studio splits its traffic
The words for this lesson2
Check yourself
Why do video calls usually use UDP instead of TCP?
Finished this lesson?
Marking it complete also marks its 2 glossary entries learned, which updates your roadmap and your saved page. 0 are already marked.