Definition
A User Datagram Protocol (UDP) is a lean, connectionless transport layer protocol. It is used in the Internet protocol suite to transmit datagrams (packets) without requiring a prior connection between the sender and receiver.
This protocol is suitable for applications that need real-time data transmissions, such as gaming, video streaming, and voice-over IP (VoIP).
How Does UDP Work?
Unlike other networking protocols, the UDP process is fairly simple. A target computer is identified, and datagrams (packets) are transmitted. The packets should arrive in no particular order, and there is no process for checking if they came.
While UDP has checksums, which ensure the integrity of the data, and port numbers, which determine the role the data plays at the source and destination, the lack of an obligatory handshake is an issue.
The programs running with UDP are exposed to the unreliable characteristics of the underlying network. As a result, there is no guarantee that the data will be delivered.
Moreover, since the order in which the packets arrive is uncontrolled, the data at the final destination may have anomalies. However, this may not be a problem when there isn’t a need to check for errors or correct the data.
User Datagram Protocol Examples
- Domain Name System (DNS): DNS queries utilize UDP to decode human-readable domain names into IP addresses.
- Voice over Internet Protocol (VoIP): VoIP services use UDP to transmit real-time audio data with minimal latency.
- Online gaming: Multiplayer games use UDP to transmit game data among players, ensuring quick response time and smooth gameplay.
User Datagram Protocol (UDP) vs. Transmission Control Protocol (TCP)
Feature | User Datagram Protocol (UDP) | Transmission Control Protocol (TCP) |
Connection | Connectionless: No configuration is required before data transfer. | Connection-oriented: Creates a connection before data transfer. |
Speed | Faster because of low overhead. | Slower because of additional reliability checks. |
Order of datagram | Datagrams may arrive out of order. | Ensures datagrams arrive in sequence. |
Header size | Smaller (8 bytes) | Larger (20 bytes) |