Transport and networkLayer 4RFC 768
UDP: fast and simple
Send a message with almost no ceremony, and accept that it may get lost.
Ports and use: Used by DNS (53), DHCP (67/68), NTP (123) and QUIC
In one sentenceUDP sends each message on its own, with no connection, no confirmation and no resending.
Think of it like thisIt is dropping a postcard in a post box. It is quick and cheap, but nobody tells you whether it arrived.
Watch it happen
3 steps and 2 byte-by-byte decodes. Use the buttons or the arrow keys. Hover or focus a field to find its bytes.
- Sender
- Receiver
- One datagramSender to Receiver
- A reply datagramReceiver to Sender
- A datagram that gets lostSender to Receiver, lost on the way
Step 1 of 3 One datagram
Sender → Receiver
The sender builds an 8-byte header and adds the data. There is no handshake first.
UDP datagram with "hello" 13 bytes
c3 50 13 88 00 0d e7 70 hello
| Field | Bytes | What it means |
|---|---|---|
| Source port | c3 50 | 50000: the sender sends from this port. |
| Destination port | 13 88 | 5000: the program that should receive it. |
| Length | 00 0d | 13 bytes: 8 of header plus 5 of data. |
| Checksum | e7 70 | Detects damage. It covers the data and the IP addresses. |
| Data | hello | The message itself. There is no sequence number and no acknowledgement. |
Step 2 of 3 A reply datagram
Receiver → Sender
If the receiver wants to answer, it sends a new datagram. It is not connected to the first one in any way.
UDP datagram with "hi" 10 bytes
13 88 c3 50 00 0a c2 df hi
| Field | Bytes | What it means |
|---|---|---|
| Source port | 13 88 | 5000: the receiver sends from this port. |
| Destination port | c3 50 | 50000: the program that should receive it. |
| Length | 00 0a | 10 bytes: 8 of header plus 2 of data. |
| Checksum | c2 df | Detects damage. It covers the data and the IP addresses. |
| Data | hi | The message itself. There is no sequence number and no acknowledgement. |
Step 3 of 3 A datagram that gets lost
Sender → Receiver lost on the way
A router drops a datagram because a link is busy. Nobody tells the sender. The application must decide what to do, for example ask again after a timeout.
Where you meet it
- DNS lookups, because one question and one answer fit in a single datagram.
- Live video, voice calls and games, where a late packet is worse than a missing one.
- QUIC and HTTP/3, which build their own reliability on top of UDP.
Common mistakes
- Assuming a UDP message arrives. It may be lost, repeated or arrive out of order.
- Sending very large datagrams, which get split into fragments and are more likely to be lost.
- Using UDP for a file download without adding your own checks.
- Forgetting that firewalls often treat UDP differently from TCP.
Try it yourself
Run these on your own computer and compare the output with the lesson above.
nc -u -l 5000Terminal 1: listen for UDP messages on port 5000.echo hello | nc -u 127.0.0.1 5000Terminal 2: send one datagram to it.
Addresses and values in the examples are made up for teaching (the 203.0.113.x range is reserved for documentation). Real traffic carries more options and details. Check the standard named above for the full rules.