Two philosophies
TCP and UDP are the two main transport protocols, and choosing between them is a recurring design decision. TCP offers a reliable, ordered byte stream with congestion control. UDP offers a thin, connectionless datagram service with almost no guarantees. Neither is better in the abstract; the right pick depends on what the application can tolerate.
When each wins
- TCP suits transfers that must arrive complete and in order, such as files, web pages, and email.
- UDP suits real time media and games where a late packet is useless and retransmission would only add delay.
- TCP adds head of line blocking, where one lost packet stalls everything behind it.
- UDP lets the application build its own lightweight reliability, sending only what it actually needs.
The tradeoff is reliability versus latency and control. TCP saves you from reimplementing acknowledgments and ordering, but its guarantees cost round trips and can stall under loss. UDP gives you a blank slate, which is why newer protocols build custom reliability on top of it to avoid TCP head of line blocking while still recovering lost data. The choice frames everything above it.
Key idea
TCP trades latency and control for a reliable ordered stream while UDP trades guarantees for a thin low latency datagram, so the choice hinges on whether the workload can tolerate loss and out of order delivery.