TCP & UDP
Comparison of Transport Protocols TCP and UDP
TCP & UDP (Quick Summary)
Both operate on L4 (Transport Layer) but have completely different purposes.
1. TCP (Transmission Control Protocol)
A Connection-Oriented protocol that prioritizes maximum data reliability.
- Features:
- Guarantees that data reaches the destination completely and in the correct order.
- Has Error Recovery (resends when lost) and Flow Control / Congestion Control (reduces speed when the network is congested).
- Three-way Handshake: Must establish a connection before sending data.
SYN(Client requests connection)SYN-ACK(Server acknowledges)ACK(Client confirms)
- Use Cases: Web Browsing (
HTTP/HTTPS), File Transfer (FTP), Email (SMTP), SSH
2. UDP (User Datagram Protocol)
A Connectionless protocol that focuses on speed and saving bandwidth.
- Features:
- Sends data immediately without caring whether the destination is ready to receive.
- No guarantee that data will arrive completely or in the correct order (No Acknowledgement).
- Use Cases: Video Streaming, Online Gaming, VoIP, DNS Resolution (because waiting for a TCP Handshake would be too slow)