Summary
TCP provides reliable, ordered, connection-oriented byte streams. UDP provides connectionless datagrams with lower overhead and no built-in reliability.
Interview Points
- TCP handles ordering, retransmission, congestion control, and flow control.
- UDP is useful when latency matters and the application can handle loss or reliability itself.
- TCP is common for HTTP/1.1, HTTP/2, databases, and many APIs.
- UDP is common for DNS, gaming, voice/video, and QUIC.
- QUIC adds reliability and encryption above UDP.
2-3 Minute Interview Script
“TCP is connection-oriented and gives reliable, ordered delivery. If packets are lost, TCP retransmits them and preserves order, which is useful for APIs, databases, and most web traffic.
UDP is connectionless. It sends datagrams without guaranteeing delivery or order. That makes it lower overhead and useful for cases where timeliness can matter more than perfect delivery, like gaming, voice, video, DNS, or protocols that implement their own reliability.
The modern twist is QUIC. HTTP/3 uses QUIC over UDP, but QUIC adds reliability, congestion control, encryption, and independent streams at the transport layer.
Interview answer: TCP gives reliability by default; UDP gives flexibility and lower overhead when the application or protocol can manage the tradeoffs.”
Follow-Ups
- Why does packet loss hurt TCP multiplexing?
- Why did HTTP/3 use UDP?