Lesson 15 intermediate

UDP, QUIC and Other Transports

UDP's tiny header and why so many protocols choose it, TCP versus UDP side by side, testing UDP services, then QUIC and HTTP/3 (encrypted, multiplexed, 1-RTT and 0-RTT, connection migration), and the niche transports SCTP, DCCP and reliable UDP.

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:

FieldSizePurpose
Source port16 bitsSender’s port (optional)
Destination port16 bitsReceiving process
Length16 bitsHeader + data
Checksum16 bitsOptional 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

TCPUDP
ConnectionHandshake firstNone, just send
ReliabilityRetransmits lost dataNone (the app decides)
OrderingGuaranteedNot guaranteed
Data modelByte streamIndividual datagrams
Header20 to 60 bytes8 bytes
Congestion controlBuilt inUp to the application
Broadcast and multicastNoYes
Typical usesWeb (HTTP/1.1, HTTP/2), SSH, email, databases, file transferDNS, 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

NeedPick
Web pages and APIsTCP (HTTP/1.1, HTTP/2) or QUIC (HTTP/3)
One quick request and answerUDP (DNS, NTP)
Live voice and videoUDP with RTP/SRTP, or WebRTC
Encrypted VPN tunnelUDP (WireGuard, IPsec NAT-T, OpenVPN UDP mode)
Telecom signalingSCTP
Bulk file transferTCP, or a tuned UDP protocol on very long fast paths

Exercise

Why does DNS normally use UDP for queries?

  1. UDP is encrypted and TCP is not
  2. One small question and answer would waste a whole round trip on a TCP handshake
  3. TCP cannot carry DNS messages
  4. UDP guarantees the answer arrives
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?

  1. It removes the need for encryption
  2. It makes packets smaller than UDP
  3. It works without IP addresses
  4. A lost packet only delays its own stream instead of stalling every stream on the connection
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?

  1. SCTP
  2. DCCP
  3. QUIC
  4. RUDP
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 UdpRcvbufErrors for 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.

↑ ↓ navigate Enter open Esc close