TCP guarantees delivery. UDP doesn't.
That's the core difference. Everything else flows from this.
TCP (Transmission Control Protocol)
Ensures every packet arrives in order and intact. If a packet gets lost, TCP resends it. Like certified mail with tracking.
How it works:
- Establishes connection before sending data
- Confirms each packet was received
- Resends lost packets
- Delivers packets in correct order
Downside: Slower. All that checking and resending adds overhead.
Used by:
- Web browsing (HTTP/HTTPS)
- Email (SMTP, IMAP)
- File transfers (FTP)
- SSH/remote access
- Any situation where accuracy matters more than speed
UDP (User Datagram Protocol)
Sends packets without confirmation. Fire and forget. Like regular mail without tracking.
How it works:
- No connection setup
- Sends packets immediately
- Doesn't check if they arrived
- Doesn't guarantee order
Upside: Much faster. No overhead from acknowledgments.
Used by:
- Online gaming (real-time action)
- Video streaming (Netflix, YouTube)
- VoIP calls (Zoom, Discord)
- DNS lookups
- Any situation where speed matters more than perfection
Why Gaming Uses UDP
In a multiplayer game, if a packet containing your position at time 1:23:45 gets lost, there's no point resending it. By the time it arrives, it's outdated. You're already at a new position.
Better to just send the next position update and keep moving. Missing one frame is fine. Waiting for retransmission would cause lag.
Why Web Browsing Uses TCP
Loading a webpage requires every piece (HTML, CSS, images) to arrive intact. One missing packet could break the entire page layout.
Speed is less critical than accuracy. You'd rather wait 0.2 seconds longer than see a broken page.
Which One Is Better?
Neither. They solve different problems.
Use TCP when: Data must be complete and accurate (downloads, messages, financial transactions).
Use UDP when: Speed and real-time performance matter more than perfect delivery (gaming, live video, voice calls).
Do You Need to Choose?
Not usually. Applications automatically use the appropriate protocol. Your browser uses TCP, your game uses UDP, your video call uses UDP.
You only care about this when:
- Configuring a firewall (need to allow specific ports for TCP or UDP)
- Port forwarding for gaming (usually UDP)
- Troubleshooting VPN or connection issues
- Setting up servers or network applications
Bottom Line
TCP is reliable but slower (verifies delivery). UDP is fast but unreliable (no verification).
Applications choose based on their needs. Web pages need accuracy (TCP). Video games need speed (UDP).
You don't need to pick. Software handles it automatically.