Communication Protocols
TCP and UDP
TCP gives you an ordered, reliable, error-checked stream. Lost packets are retransmitted, out-of-order packets are reassembled, and a congestion controller slows you down when the network is struggling. You pay for this with a handshake before any data moves and with head-of-line blocking: one lost packet stalls everything queued behind it, even data that arrived fine.
UDP gives you almost nothing. Datagrams may arrive out of order, more than once, or not at all. There is no handshake, no retransmission, and no congestion control unless you build it.
That sounds strictly worse until you consider what reliability costs. In a live video call, a packet from 400ms ago is useless — retransmitting it delays every fresh packet behind it to deliver audio nobody wants to hear any more. Dropping it is the correct behaviour.
So choose the guarantees around what stale data is worth. A reliable ordered stream such as TCP fits data that must arrive intact; UDP is a useful substrate when the application prefers fresh data and supplies only the recovery, ordering, or congestion behavior it actually needs.
TCP UDP ordered unordered reliable (retransmits) best effort congestion controlled no control handshake before data no handshake head-of-line blocking no blocking file transfer, APIs, video, voice, games, databases, anything telemetry, DNS queries where loss is fatal where late == lost
QUIC (and therefore HTTP/3) is built on UDP precisely to escape TCP's head-of-line blocking, then reimplements reliability per-stream on top. The lesson is that the guarantees are separable — you do not have to take them as a bundle.
3 components2 connections0:00
Recording…