TCP vs UDP
Once IP routing gets packets to the right device, something needs to manage the actual data transfer. Two protocols handle this job differently: TCP and UDP.
TCP: Reliable Delivery
TCP (Transmission Control Protocol) is like registered mail with tracking and delivery confirmation. It guarantees that:
- All data arrives
- Data arrives in the correct order
- Corrupted data gets detected and resent
TCP achieves this through acknowledgments. When you send data, the receiver confirms receipt. If confirmation doesn't arrive, the sender resends. This creates overhead — extra messages going back and forth — but ensures reliability.
TCP is used for:
- Web browsing (HTTP/HTTPS)
- File downloads
- Any situation where missing data is unacceptable
UDP: Speed Over Guarantees
UDP (User Datagram Protocol) is like sending a postcard. It's fast and lightweight, but there's no guarantee it arrives, and no confirmation either way.
UDP skips the acknowledgment overhead. It just sends packets and hopes for the best. This sounds unreliable, but for some applications, speed matters more than perfection.
UDP is used for:
- Video streaming (a dropped frame is better than pausing to resend)
- Online gaming (old position data is useless anyway)
- Voice calls (slight glitches beat awkward delays)
- DNS lookups (quick queries that can be retried if needed)
Choosing the Right Protocol
The choice depends on what matters more for your application:
| Need | Choose |
|---|---|
| Every byte must arrive correctly | TCP |
| Speed and low latency are critical | UDP |
| Order matters | TCP |
| Real-time data where old info is useless | UDP |
Most applications use TCP because reliability usually matters. But understanding UDP helps you appreciate why video calls sometimes glitch rather than freeze, and why games prioritize responsiveness over perfection.
See More
- What Is a Packet?
- Application Protocols: HTTP, HTTPS, SSH, FTP
- How Network Layers Work Together
- TCP
- UDP