What guarantees does UDP provide?
UDP provides a minimum of guarantees. This is done deliberately, to ensure simplicity and minimal latency.
What guarantees UDP does have
1. Message boundaries are preserved
UDP transfers data as messages (datagrams):
- one send = one message
- if a message arrives, it arrives whole
This means:
- UDP does not merge and does not split messages for the application
2. "Best effort" delivery
UDP tries to deliver data:
- without promises
- without retries
- without acknowledgments
If a message arrives, the application will receive it. If not, UDP does nothing about it.
What UDP does NOT guarantee (important)
UDP does not guarantee:
- data delivery
- delivery order
- the absence of duplicates
- the integrity of the data stream
- speed control
- congestion control
- connection establishment
All of these tasks, when needed, must be solved by the application itself.
Comparing TCP and UDP guarantees
| Guarantee | TCP | UDP |
|---|---|---|
| Delivery | Yes | No |
| Order | Yes | No |
| Retries | Yes | No |
| Flow control | Yes | No |
| Congestion control | Yes | No |
| Message boundaries | No (stream) | Yes (messages) |
Why UDP is still used
Because sometimes what matters more is:
- minimal latency
- predictable delivery time
than perfect reliability.
That is why UDP is used for:
- VoIP
- video streaming
- online games
- DNS
In short, for the interview
UDP does not guarantee the delivery, order, or integrity of data transmission; it only provides delivery of individual messages without establishing a connection and with minimal overhead.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.