Communication Networks · Visualized

UDP: User Datagram Protocol

Transport Reliability

TCP connections, retransmission timers and sliding windows that make lossy links behave.

6 interactive subtopics — each one animated, step-through and explained.

UDP: User Datagram Protocol

Transport Reliability

UDP is the minimal transport: it takes an application message, stamps an 8-byte header (source port, dest port, length, checksum) and throws it onto IP. No connection setup, no retransmission, no ordering — just one datagram, best effort. That simplicity is a feature: no handshake delay, no head-of-line blocking, and almost no overhead, which is exactly what live audio, gaming and DNS want.

How UDP: User Datagram Protocol Works

  1. The application hands UDP a message and a destination port — that is the whole API.
  2. UDP prepends its 8-byte header; ports identify which app on each machine gets the data.
  3. The datagram is handed straight to IP and routed — if a router drops it, nobody resends it.
  4. The checksum (optional in IPv4) detects corruption; a bad datagram is silently discarded.
  5. Applications needing reliability add their own recovery — or retransmit at the app level (QUIC, WebRTC, gaming state updates).

UDP: User Datagram Protocol Worked Example

Try it: Compare a DNS lookup and a file transfer over the same lossy link.

The DNS query rides one UDP datagram — one RTT, gone, done. The TCP file transfer must handshake, negotiate, retransmit every lost segment, then tear down: dozens of RTTs. For a single quick question UDP wins; for a guaranteed bulk delivery TCP wins.

Appmsg → UDPUDP8-byte headerIProute itNetmaybe dropApptake it as-is8 B header · 1 RTT · best effort
UDP path completed step
Stage 1 / 4
The app hands over one message. UDP stamps its tiny 8-byte header (ports + length + checksum) and hands it to IP. No setup, no state.

UDP: User Datagram Protocol: Key Facts to Remember

Header costUDP: 8 bytes · TCP: 20–60 bytes — big deal at 64-byte packets
Port 53DNS, DHCP, SNMP, NTP, RTP and VoIP all speak UDP
Modern twistQUIC (HTTP/3) rebuilds reliability on top of UDP — the best of both

Recommended resourcesAffiliate links · may earn us a commission

Recommended for learners

Cloud hosting for side projectsShip the portfolio project that gets you hired — free credits for new accounts.Claim credits Pro code editor & AI assistantWrite, debug and explain code faster while you practice the patterns here.Try it free Structured coding coursesVideo courses that pair well with visual practice — pick one language and go deep.Browse courses

See how packets really travel

Networks are built on the structures and algorithms you can watch step by step — queues, trees, and routing algorithms.