TCP vs UDP: Handshakes, Retransmission & Out-of-Order Delivery
Almost every internet application sits on top of either TCP or UDP. Choosing between them is a classic engineering tradeoff: do you want the transport layer to guarantee ordered, lossless delivery, or do you want minimal latency where your application decides how to handle missing packets?
Explore Protocol Explorer & its website →
Behavior follows RFC 9293 (TCP) and RFC 768 (UDP), demonstrated with synthetic packet sequences in NavSprout’s Protocol Explorer.
TCP vs UDP: what changes on the wire
TCP establishes state on both endpoints before sending application bytes, tracks every byte with sequence and acknowledgment numbers, and retransmits lost segments automatically. UDP wraps each message in an 8-byte header and fires it immediately—no handshake, no retransmission, and no guarantee that packet 4 arrives after packet 3.
| Property | TCP (RFC 9293) | UDP (RFC 768) |
|---|---|---|
| Connection setup | 3-way handshake (SYN → SYN-ACK → ACK) | None (stateless datagrams) |
| Header overhead | 20 bytes minimum (+ options) | 8 bytes fixed |
| Packet loss handling | Automatic retransmission + congestion control | Dropped silently unless app retries |
| Ordering | Strict byte-stream ordering (head-of-line blocking) | Datagrams can arrive out of order |
| Common protocols | HTTP/1.1, HTTP/2, SSH, SMTP, PostgreSQL | DNS queries, VoIP, gaming, HTTP/3 (QUIC) |
Inspect both behaviors in Protocol Explorer
- Open the TCP lesson and step through SYN, SYN-ACK, and ACK. Notice how sequence numbers increment by byte length and how a lost segment triggers retransmission before the application stream advances.
- Open the UDP lesson and watch a packet arrive out of order while another packet drops—notice that later datagrams still reach the application immediately without waiting.
- Click any packet row in the workbench to inspect the raw header fields (source port, destination port, flags, and checksum).
Why modern web protocols (HTTP/3) build reliability on UDP
In TCP, a single lost packet stalls every multiplexed stream sharing that connection until the retransmission arrives (head-of-line blocking). HTTP/3 avoids this by running QUIC over UDP: it re-implements encryption, congestion control, and per-stream retransmission in user space so one lost stream does not freeze unrelated assets.
Common questions
Does UDP mean “unreliable and broken”?
No. For live audio, video calls, and real-time game state, waiting 200 ms to retransmit an outdated packet is worse than skipping it and playing the next fresh frame.
Why does TCP need three packets for a handshake instead of two?
Both sides must confirm they can send AND receive each other’s initial sequence numbers before exchanging application data, preventing stale duplicate packets from opening phantom connections.
How does TCP know a packet was lost?
Either the sender receives duplicate ACKs for an earlier sequence number (fast retransmit) or its retransmission timer expires before an acknowledgment arrives.
Sources & editorial method
Written by NavSprout Editorial. Published and checked .
- IETF RFC 9293 — Transmission Control Protocol (TCP) ↗
- IETF RFC 768 — User Datagram Protocol (UDP) ↗
- NavSprout Protocol Explorer ↗