What TCP provides
TCP offers an ordered, reliable byte stream between endpoints. It tracks sequence numbers, acknowledges received data, retransmits missing segments and applies flow and congestion control. The application does not see individual TCP packets as message boundaries: a single write can be delivered through multiple reads and vice versa.
Before application data flows, TCP normally uses a three-way handshake to establish connection state. Reliability is useful for web pages, file transfers and remote shells, although applications still need timeouts and error handling.
What UDP provides
UDP sends individual datagrams with minimal transport-level machinery. It does not automatically retransmit lost datagrams or guarantee arrival order. Applications can choose how much reliability, sequencing or congestion response they need.
DNS traditionally uses UDP for many exchanges, with TCP also used when needed. Interactive voice, games and other latency-sensitive protocols may favor UDP when delayed packets are less useful than missing packets.
The QUIC example
QUIC uses UDP as a substrate but builds in encryption, congestion control, reliable streams and connection management. HTTP/3 uses QUIC, so “UDP is unreliable” does not imply “HTTP/3 is unreliable.” Reliability can be implemented above UDP, tailored to the application.
Choosing a transport is about required semantics, network behavior and deployment constraints—not a blanket claim that one protocol is always faster.
A useful mental model
| Property | TCP | UDP |
|---|---|---|
| Data model | Byte stream | Datagrams |
| Built-in retransmission | Yes | No |
| Guaranteed ordering at transport | Yes | No |
| Typical examples | SSH, HTTP/1.1, HTTP/2 | DNS, QUIC, real-time applications |