U

UDP (User Datagram Protocol)

UDP is a transport-layer protocol that sends data without establishing a connection, favoring speed and low latency over reliability.

What is UDP?

User Datagram Protocol (UDP) is a transport-layer protocol used to send data over IP networks without establishing a connection and without guaranteeing delivery, order, or duplication protection. UDP is designed for scenarios where speed and low latency are more important than reliability.

UDP is a core protocol of the internet stack, alongside TCP.

Why UDP matters

UDP is important because it:

  • Minimizes transmission latency
  • Reduces protocol overhead
  • Performs well on unstable or high-latency links
  • Scales efficiently for real-time and broadcast use cases
  • Enables applications to manage reliability themselves

Many real-time applications depend on UDP's performance characteristics.

How UDP works (simplified)

UDP communication is straightforward:

  1. An application sends a datagram to a destination IP and port
  2. The network delivers the packet on a best-effort basis
  3. No handshake, acknowledgment, or retransmission occurs

Each packet is independent and stateless.

UDP ports

Like TCP, UDP uses ports to identify services:

  • Port range: 0–65535
  • Well-known ports for common services
  • Multiple applications can share an IP using different ports

Firewalls often filter UDP traffic by port and direction.

UDP vs TCP

AspectUDPTCP
ConnectionNoYes
ReliabilityNo guaranteeGuaranteed
OrderingNoYes
LatencyVery lowHigher
OverheadMinimalHigher
Typical usesReal-time, streamingWeb, email, files

UDP prioritizes speed; TCP prioritizes reliability.

Common UDP use cases

UDP is commonly used for:

  • DNS queries
  • VoIP and video conferencing
  • Online gaming
  • Streaming media
  • DHCP
  • NTP
  • Real-time telemetry

In these cases, late packets are often worse than lost packets.

UDP and application-level reliability

Because UDP lacks built-in reliability:

  • Applications may implement their own checks
  • Error correction and retransmission can be custom
  • Some protocols add sequencing and timing logic
  • Modern protocols may build on UDP for flexibility

This gives developers fine-grained control over behavior.

UDP and security

Security considerations include:

  • UDP traffic is harder to inspect statefully
  • Susceptible to spoofing and reflection/amplification attacks
  • Often targeted in DDoS scenarios
  • Requires careful firewall and rate-limiting rules

UDP itself provides no encryption or authentication.

Performance considerations

UDP performs well when:

  • Low latency is critical
  • Packet loss is acceptable
  • Network conditions vary
  • High throughput with minimal overhead is needed

However, reliability must be handled elsewhere if required.

Common misconceptions

  • "UDP is unreliable and unsafe by default"
  • "UDP cannot be secured"
  • "UDP is only for streaming"
  • "UDP always outperforms TCP"