A technical look at UDP's 'fire and forget' design, why it's used in real-time applications, and the trade-offs compared to TCP.
The classic programmer joke goes: "I'd tell you a UDP joke, but you might not get it." This isn't just wordplay—it's actually a precise description of how the protocol works.
What UDP Actually Does
UDP (User Datagram Protocol) operates as a connectionless protocol that sends data without establishing a connection first. When you send a UDP packet, there's no handshake, no acknowledgment, and no guarantee of delivery. The sender just fires off a datagram and moves on.
This design makes UDP extremely lightweight. A UDP header is only 8 bytes compared to TCP's 20-byte minimum. No connection state needs to be maintained on either end. The sender doesn't care if the receiver is ready, listening, or even exists.
Where UDP Makes Sense
Real-time applications rely on UDP because speed matters more than perfect reliability:
Voice and video streaming - When you're on a VoIP call, losing a few packets means a tiny audio glitch. Waiting for retransmission would cause unacceptable delays. Better to skip the missing data and keep the conversation flowing.
Online gaming - Player position updates need to arrive immediately. If a position packet is lost, the next one arrives milliseconds later with updated information. Retransmitting old data would actually make the game experience worse.
DNS queries - When your browser looks up a domain name, it needs a response quickly. A single UDP request with a timeout is faster than establishing a TCP connection. If the request fails, the system can retry.
Sensor networks and IoT - Devices sending periodic readings can tolerate occasional data loss. The overhead of TCP connections would drain batteries and overwhelm low-power networks.
The Trade-offs You Accept
UDP's simplicity comes with serious caveats:
No delivery guarantee - Packets can vanish without a trace. Network congestion, router failures, or cable issues can drop packets silently.
No ordering - Packets can arrive out of sequence. If you send three messages, they might arrive as 3-1-2.
No congestion control - UDP will happily flood the network, potentially causing problems for other traffic. TCP backs off when it detects congestion; UDP does not.
No error checking - Beyond a basic checksum, UDP doesn't verify data integrity. Corrupted packets get delivered as-is.
Building Reliability on Top
Many systems that need UDP's speed but can't tolerate data loss implement their own reliability layer:
QUIC (Quick UDP Internet Connections), used by HTTP/3, builds connection multiplexing, encryption, and retransmission on top of UDP while avoiding TCP's head-of-line blocking.
Custom protocols - Games often implement sequence numbers and selective retransmission for critical packets while letting less important data go without guarantees.
Application-level acks - Systems can send periodic status updates rather than requesting acknowledgment for every packet.
The Joke's Technical Accuracy
The UDP joke works because it captures the protocol's fundamental characteristic: there's no mechanism to ensure the message arrives. The sender has no way of knowing whether the receiver "got it" unless the application builds that functionality itself.
This is why UDP is sometimes called a "send and pray" protocol. It's not designed for reliability—it's designed for speed. Whether that's the right choice depends entirely on what you're building and what you're willing to sacrifice.
For applications where every bit of data must arrive in order, TCP remains the standard. For everything else, UDP's lightweight, connectionless approach provides the foundation for modern real-time communication.

Comments
Please log in or register to join the discussion