TCP vs UDP in Real-Time Applications: Use Cases

TCP vs UDP for real-time apps: head-of-line blocking, why calls and games use UDP, where QUIC fits, and a use-case table from VoIP to trading.

Jul 30, 2025 - 13:08
Nov 5, 2026 - 08:14
 0  131
TOPICDevOps BasicsPractical guide
TCP vs UDP in Real-Time Applications: Use Cases

TCP delivers every byte in order and retransmits losses, which adds delay when packets drop. UDP sends datagrams with no retransmission or ordering, so late data never blocks new data. Real-time apps pick based on whether stale data is useless: voice, video calls and games use UDP (often through RTP or QUIC), while chat, trading orders and file sync stay on TCP.

Both protocols live at the transport layer. If you need a refresher on layers first, read our pillar post What Is the OSI Model? and the companion TCP/IP model with real-world examples. This post focuses on one question: which transport fits each kind of real-time application, and why.

Key takeaways

  • TCP (RFC 9293) gives reliable, ordered byte streams with congestion control. A lost packet holds up everything behind it until it is retransmitted.
  • UDP (RFC 768) gives an 8-byte header and nothing else. The application decides what to do about loss and order.
  • For interactive audio and video, a late packet is as bad as a lost one, so UDP-based protocols such as RTP and WebRTC media win.
  • QUIC (RFC 9000) runs over UDP but adds reliability per stream, encryption and fast handshakes. HTTP/3 uses it.
  • Streaming video on demand still mostly uses HTTP over TCP or QUIC, because buffering hides delay.
  • Pick by tolerance for delay and loss, not by "speed". UDP is not automatically faster.

The core difference in one table

PropertyTCPUDP
ConnectionThree-way handshake before dataNone; send immediately
DeliveryReliable, with retransmissionBest effort
OrderingStrict byte orderNo ordering
Message boundariesByte stream; app must frame messagesEach datagram is one message
Congestion controlBuilt inNone; the app should add its own
Header size20 bytes minimum8 bytes
Multicast and broadcastNoYes
Typical real-time usersChat, trading orders, remote shells, HLS/DASH segmentsVoice, video calls, games, DNS, market data feeds

Why "reliable" can hurt real-time traffic

TCP's promise is that the receiving application sees every byte in order. If packet 5 of 10 is lost, packets 6 to 10 may arrive, but the kernel holds them until packet 5 is retransmitted. This is head-of-line blocking. On a clean network it costs nothing. On a lossy mobile or Wi-Fi link, one retransmission adds at least one round trip, often more, and the app sees a burst of delayed data.

For a file download that delay does not matter. For a voice call it does. Audio is played on a fixed schedule; a 20 ms frame that arrives 200 ms late is useless, and waiting for it delays every frame behind it. Voice codecs and jitter buffers are designed to hide a lost frame, so it is better to skip it and play the next one. That is the main reason interactive media runs over UDP.

A second TCP effect is congestion control backing off after loss, which lowers throughput sharply on a lossy link. Media protocols over UDP use their own rate control tuned for media, such as Google Congestion Control in WebRTC, which adjusts video bitrate rather than stalling.

Use case by use case

ApplicationUsual transportReason
Voice over IP (SIP calls)RTP/SRTP over UDP; SIP signalling over UDP, TCP or TLSLate audio is useless; codecs conceal small losses
Video calls in the browser (WebRTC)SRTP over UDP, with TCP or TURN relay as fallbackLow delay matters more than perfect frames
Online multiplayer gamesCustom protocols over UDPNewest position update replaces the old one
Live streaming to large audiencesHLS or DASH over HTTP (TCP or QUIC); low-latency variants availableA few seconds of buffer hides retransmission and works with CDNs
Video on demandHTTP over TCP or QUICEvery frame must arrive; buffering is acceptable
Chat and notificationsWebSocket over TCP, or HTTP/3 over QUICMessages must arrive complete and in order
Trading order entry (FIX)TCPAn order must never be lost or duplicated
Exchange market data feedsOften UDP multicast, with recovery channelsOne sender reaches many receivers; gaps are filled separately
DNS lookupsUDP first, TCP for large responses and zone transfersOne small request and reply; no handshake cost
IoT telemetryMQTT over TCP, or CoAP over UDPMQTT for reliable brokered delivery; CoAP for constrained devices
Remote desktopOften UDP with TCP fallbackScreen updates tolerate loss; input needs to be responsive

Exchanges publish their own feed specifications, and designs vary, so treat the market data row as a common pattern rather than a rule for every venue.

What UDP applications must build themselves

Choosing UDP moves work from the kernel into the application. A real-time protocol over UDP usually adds:

  • Sequence numbers and timestamps so the receiver can detect loss, reorder and schedule playback. RTP (RFC 3550) provides both.
  • Jitter buffers that hold packets briefly to smooth arrival times.
  • Selective reliability: retransmit only what still matters, such as a video keyframe, and ignore the rest.
  • Forward error correction so some losses can be repaired without a round trip.
  • Congestion control, because UDP has none and an app that floods a link harms everyone on it. RFC 8085 gives guidelines for UDP applications.
  • Encryption, through DTLS or SRTP, since UDP has no TLS of its own.
  • NAT traversal, using STUN, TURN and ICE in WebRTC, because NAT devices drop unsolicited UDP.

QUIC: the middle path

QUIC, standardized in RFC 9000 in 2021, runs over UDP but provides reliable, encrypted, multiplexed streams. Loss on one stream does not block others, which removes TCP's head-of-line blocking between streams. The handshake combines transport and TLS 1.3 setup, and resumed connections can send data in the first flight. HTTP/3 (RFC 9114) runs on QUIC.

QUIC also has an unreliable datagram extension (RFC 9221), which lets an application mix reliable streams and loss-tolerant datagrams on one connection. Newer media protocols are being built on it, though many are still drafts at the IETF. For most teams, QUIC shows up through HTTP/3 support in CDNs, browsers and load balancers rather than as something to code against directly.

Tuning TCP for interactive use

When an app must use TCP, a few settings reduce delay:

  • Set TCP_NODELAY to disable Nagle's algorithm, so small writes go out immediately. Most interactive protocols and many frameworks do this by default.
  • Keep connections open and reuse them to avoid repeated handshakes.
  • Avoid sending large and small messages on the same connection, where a big transfer can delay a small urgent one.
  • Consider modern congestion control such as BBR on servers, after testing on your own traffic.
import socket

s = socket.create_connection(("orders.example.com", 9443))
s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)  # send small messages immediately

Operational differences DevOps teams notice

AreaTCPUDP
Load balancingConnection-based; well supported by L4 and L7 balancersFlow hashing on 5-tuple; needs UDP support (AWS NLB supports UDP)
Firewalls and NATStateful tracking via handshake and FINTracked by timeout; idle flows expire sooner
Kubernetes ServicesDefault protocolSet protocol: UDP on the port
TroubleshootingHandshake and retransmissions visible in capturesLoss is silent; rely on app metrics such as jitter and packet loss
Corporate networksAlmost always allowedSometimes blocked, so apps need a TCP fallback

Useful commands for checking what listens on a host:

ss -tulpn                  # TCP and UDP listening sockets with processes
sudo tcpdump -ni any udp port 3478   # watch STUN traffic for WebRTC
ss -ti dst 203.0.113.10    # TCP internals: rtt, retransmits, cwnd

When you open ports for real-time services, keep exposure tight. Our guides on securing TCP and UDP services and commonly exploited port numbers cover hardening. For a list of which protocols sit at which layer, see protocols at each OSI layer.

A quick decision guide

  1. Does stale data lose its value within a fraction of a second? If yes, lean toward UDP with a media or game protocol.
  2. Must every message arrive exactly once and in order? If yes, use TCP or QUIC streams.
  3. Do you need one-to-many delivery on a local network? UDP multicast is the only option of the two.
  4. Will users sit behind restrictive firewalls? Plan a TCP or TLS fallback.
  5. Do you want UDP's latency without writing your own reliability? Look at QUIC.

Frequently asked questions

Is UDP faster than TCP?

Not by itself. On a clean network both move data at similar speeds. UDP avoids handshake and retransmission delays, which matters when packets are lost or when late data is useless.

Why do video calls use UDP?

A late audio or video frame is useless, and TCP would hold newer frames while it retransmits the old one. UDP lets the app skip the lost frame and keep playing.

Does YouTube or Netflix use TCP or UDP?

On-demand streaming uses HTTP, which runs over TCP or, with HTTP/3, over QUIC on UDP. Buffering hides retransmission delay, so reliable delivery works well.

What is head-of-line blocking?

When one lost TCP packet makes the receiver wait for its retransmission before delivering later packets that already arrived. QUIC avoids it between streams.

Is QUIC TCP or UDP?

QUIC runs over UDP but provides reliable, ordered, encrypted streams like TCP with TLS. HTTP/3 is built on it.

Do online games use TCP or UDP?

Fast-paced games mostly use UDP so the newest state update replaces old ones. Turn-based games and chat features often use TCP.

Why does DNS use UDP?

Most lookups are one small question and one small answer, so a handshake would double the delay. DNS falls back to TCP for large responses and zone transfers.

Learn networking for DevOps

Transport protocols, sockets, firewalls and packet captures are part of the Linux networking modules in our Linux administration training, taught in our Kharadi, Pune classroom and live online across India.

References

Interested in learning more?Get a callback from our training advisors.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Angry Angry 0
Sad Sad 0
Wow Wow 0
Mridul I am a passionate technology enthusiast with a strong focus on DevOps, Cloud Computing, and Cybersecurity. Through my blogs at DevOps Training Institute, I aim to simplify complex concepts and share practical insights for learners and professionals. My goal is to empower readers with knowledge, hands-on tips, and industry best practices to stay ahead in the ever-evolving world of DevOps.