Source
User Datagram Protocol
UDP properties, features and typical usage scenarios.
UDP is a lightweight transport protocol focused on speed and minimal latency. It does not guarantee delivery or order, but is well suited for real-time scenarios.
UDP Features
No connection
UDP does not establish a connection before transmitting data. Dispatch is immediate.
Best-effort delivery
There is no built-in guarantee of delivery, order or retransmission.
Low overhead
The UDP header is short, which reduces overhead and latency.
Messages (datagrams)
UDP operates on individual datagrams while maintaining message boundaries.
How does the exchange take place in UDP?
UDP is connectionless: each message is a separate datagram that is sent to the network all at once and may arrive, get lost, or arrive out of order.
How exchange works in UDP
UDP sends datagrams without connection setup or acknowledgments.
Broadcast and multicast in UDP
UDP can be used for broadcasting: the sender sends a datagram to a broadcast address (for example, a subnet address), and all nodes on the segment receive it. In practice, this only works within the local network and often requires explicit broadcast permission on the socket; routers usually block such packets. If you need one-to-many broadcasting outside the segment, use multicast (if it is supported by the network) or applied broadcasting through the server.
Where UDP fits best
- Real-time multimedia (VoIP, video calling, streaming)
- Online games and interactive applications
- DNS and other short queries
- Telemetry and metrics
- Broadcasting and multicast
Comparison of TCP and UDP
TCP
- Reliable delivery and order
- Connection before transmission
- Flow and congestion control
- More overhead
UDP
- Best-effort delivery without guarantees
- No handshake, send immediately
- Minimum overhead
- Better for real-time
