TCP’s guarantees are not free: a handshake before any data, retransmissions that stall everything behind a lost segment, and kernel logic that applications cannot change. UDP offers almost nothing on top of IP, and that is exactly why it is popular: applications get speed and control, and can build their own reliability if they need it. The most important protocol built that way is QUIC, which now carries a large share of web traffic.
UDP in one table
The whole UDP header is 8 bytes:
| Field | Size | Purpose |
|---|---|---|
| Source port | 16 bits | Sender’s port (optional) |
| Destination port | 16 bits | Receiving process |
| Length | 16 bits | Header + data |
| Checksum | 16 bits | Optional in IPv4, required in IPv6 |
No handshake, no sequence numbers, no acknowledgments, no retransmission, no ordering, no flow or congestion control. Each send() becomes one datagram with clear message boundaries; it arrives once, or not at all, possibly out of order.
TCP vs UDP
| TCP | UDP | |
|---|---|---|
| Connection | Handshake first | None, just send |
| Reliability | Retransmits lost data | None (the app decides) |
| Ordering | Guaranteed | Not guaranteed |
| Data model | Byte stream | Individual datagrams |
| Header | 20 to 60 bytes | 8 bytes |
| Congestion control | Built in | Up to the application |
| Broadcast and multicast | No | Yes |
| Typical uses | Web (HTTP/1.1, HTTP/2), SSH, email, databases, file transfer | DNS, DHCP, NTP, SNMP, VoIP, video calls, games, VPNs (WireGuard), QUIC |
Choose UDP when:
- Late data is useless. A voice packet that arrives 300 ms late is worse than a lost one; just play the next one.
- The exchange is one question, one answer. DNS and NTP would waste a whole round trip on a handshake.
- You need multicast or broadcast. DHCP discovery, IPTV.
- You want your own transport logic in user space, as QUIC, WireGuard and game engines do.
Testing UDP services
UDP has no handshake, so “is the port open?” is harder to answer. A closed UDP port usually triggers an ICMP “port unreachable”; an open one may simply stay silent.
$ ss -ulnp
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
UNCONN 0 0 127.0.0.53%lo:53 0.0.0.0:* users:(("systemd-resolve",pid=601,fd=13))
UNCONN 0 0 0.0.0.0:51820 0.0.0.0:*
UNCONN 0 0 0.0.0.0:123 0.0.0.0:* users:(("chronyd",pid=702,fd=5))
$ nc -u -z -v 192.168.1.1 53
Connection to 192.168.1.1 53 port [udp/domain] succeeded!
The best UDP test is a real request in the service’s own protocol: dig for DNS, chronyc or ntpdate -q for NTP, snmpget for SNMP.
ss -u shows sockets as UNCONN because UDP has no connections. Watch for drops when a UDP service is overwhelmed:
$ nstat -az | grep -E 'UdpRcvbufErrors|UdpInErrors'
UdpInErrors 1204 0.0
UdpRcvbufErrors 1204 0.0
Rising RcvbufErrors means datagrams arrived faster than the application read them and the kernel dropped the overflow. Fix the application or raise its socket buffer.
QUIC
QUIC (RFC 9000) is a transport built on UDP by Google and standardized by the IETF. HTTP/3 runs on it, and every major browser and CDN supports it.
What it improves over TCP + TLS:
- Faster setup. The transport and TLS 1.3 handshakes are combined into one round trip. Returning clients can send data immediately with 0-RTT.
- No head-of-line blocking between streams. HTTP/2 multiplexes many requests over one TCP connection, but one lost TCP segment stalls all of them. QUIC streams are independent: a loss only delays its own stream.
- Always encrypted. Even most transport headers are encrypted, so middleboxes cannot interfere with (or ossify) the protocol.
- Connection migration. Connections are identified by a connection ID, not the 4-tuple, so a phone moving from Wi-Fi to 5G keeps its connection.
- Evolves in user space. Browsers and servers ship new congestion control or features without waiting for operating system kernels.
$ curl -sI --http3 https://cloudflare-quic.com | head -1
HTTP/3 200
$ curl -sI https://www.google.com | grep -i alt-svc
alt-svc: h3=":443"; ma=2592000
--http3 needs a curl build with HTTP/3 support (curl -V lists HTTP3 under Features). Servers advertise HTTP/3 with the Alt-Svc header (or an HTTPS DNS record); the browser then tries QUIC on UDP 443 and falls back to TCP if UDP is blocked. Firewalls that only allow TCP 443 silently force everything back to HTTP/2.
Trade-offs: QUIC uses more CPU than kernel TCP, and because it is encrypted, network teams cannot inspect it the way they inspected TCP. Some companies block UDP 443 so traffic falls back to TCP where their security tools can see it.
SCTP
The Stream Control Transmission Protocol (IP protocol 132) is message-oriented like UDP but reliable like TCP, with two signature features:
- Multi-streaming: several independent streams in one association, avoiding head-of-line blocking (an idea QUIC later adopted).
- Multi-homing: an association can use several IP addresses per endpoint and fail over between them.
It never took off on the open internet, because NAT devices and firewalls do not understand it, but it is essential in telecom: the signaling inside 4G and 5G cores runs on SCTP. WebRTC data channels also use SCTP, tunneled over DTLS and UDP.
DCCP
The Datagram Congestion Control Protocol (IP protocol 33) is unreliable like UDP but adds congestion control, intended for streaming media that should not flood the network. It is rarely deployed; applications got the same result by adding congestion control on top of UDP themselves.
Reliable UDP
RUDP is a general name for protocols that add acknowledgments and retransmission on top of UDP, tuned for one purpose: game networking libraries (ENet, for example), the UDP-based data transfer protocol UDT, and media protocols such as SRT for live video contribution. QUIC is the standardized, general-purpose answer to the same need.
Choosing a transport
| Need | Pick |
|---|---|
| Web pages and APIs | TCP (HTTP/1.1, HTTP/2) or QUIC (HTTP/3) |
| One quick request and answer | UDP (DNS, NTP) |
| Live voice and video | UDP with RTP/SRTP, or WebRTC |
| Encrypted VPN tunnel | UDP (WireGuard, IPsec NAT-T, OpenVPN UDP mode) |
| Telecom signaling | SCTP |
| Bulk file transfer | TCP, or a tuned UDP protocol on very long fast paths |
Exercise
Why does DNS normally use UDP for queries?
Show answer
Answer: B. A typical DNS exchange is one datagram each way. UDP avoids the handshake; the client simply retries if no answer comes. DNS falls back to TCP for large answers.
Exercise
What problem does QUIC solve that HTTP/2 over TCP cannot?
Show answer
Answer: D. HTTP/2 multiplexes streams over one TCP byte stream, so a single loss blocks them all. QUIC tracks each stream separately.
Exercise
Which transport do 4G and 5G mobile core networks use for much of their signaling?
Show answer
Answer: A. Telecom signaling (for example S1AP and NGAP) runs over SCTP, using its multi-streaming and multi-homing for reliability.
Key takeaways
- UDP is an 8-byte header and nothing else: no handshake, no retransmission, no ordering.
- Use UDP when late data is useless, exchanges are tiny, or you need multicast.
- Test UDP services with a real protocol request; watch
UdpRcvbufErrorsfor drops. - QUIC (HTTP/3) runs on UDP 443 with built-in TLS 1.3, independent streams and connection migration.
- SCTP powers telecom signaling; DCCP and reliable-UDP libraries fill niches.
FAQ
Is UDP less secure than TCP?
Neither is encrypted on its own. UDP is easier to spoof because there is no handshake, which is why UDP services such as open DNS resolvers or NTP servers get abused for amplification attacks. Security comes from layers above (DTLS, QUIC’s TLS, WireGuard).
Does DNS ever use TCP?
Yes: for zone transfers, for answers too big for a UDP message, when the server sets the truncated flag, and for DNS over TLS on port 853.
How do I know if my browser uses HTTP/3?
In the browser’s developer tools, add the “Protocol” column to the Network tab. h3 means HTTP/3 over QUIC, h2 means HTTP/2 over TCP.
Will QUIC replace TCP?
For web traffic it is well on its way. TCP will stay for a very long time in databases, SSH, internal services and anything that does not benefit from QUIC’s features.