User Datagram Protocol or UDP is an alternate communication protocol similar to Transmission Control Protocol or TCP.  UDP is largely used for establishing internet connections among applications that can afford lower latency and loss of data. Both of these protocols run on the Internet Protocol and hence sometimes represented as UDP/IP and TCP/IP. In spite of the similarities, there are many important differences between the two protocols and we will discuss them in this article. Firstly, lets understand what is UDP and how it works?

Definition of User Datagram Protocol :

User Datagram Protocol is a transport layer protocol. Also, UDP is a part of Internet Protocol suite hence also mentioned as UDP/IP. This protocol is not reliable and connectionless which is why its in use where it is not necessary to establish a connection between application before the data transfer. Datagram in UDP is similar to the packet of information. It is different from TCP in the sense that this protocol neglects the error checking step while transferring data. This results in speedy data transfer without the repeated communication and delivery guarantee.

User Datagram Protocol is a transport layer protocol. UDP is a part of Internet Protocol suite hence also mentioned as UDP/IP. This protocol is unpredictable and connectionless which is why it is used where the need to establish a connection between application is not required before the data transfer. For example, DNS, IP telephone, DHCP, live broadcasts & online games etc.

How does User Datagram Protocol work?

How does user datagram protocol work?

The above picture shows a layman description of how UDP works. The UDP protocol works almost in a similar manner as TCP. However, it does not recognize the error-checking feature. UDP avoids latency by removing the repeated transmission and keeps the information flowing from sender to receiver without worrying about the data loss.

When an application uses UDP, data packets move continuously from the sender to the receiver without waiting for the acknowledgement from the receiver. In case of loss of data packets at the receiving end,  the sender will not resend them. This allows UDP to communicate faster. The datagrams received while using UDP may not be in order or incomplete as they can travel across various paths from sender to receiver.

UDP offers two features which not present in the IP layer. It assigns port numbers to identify distinct user requests as well as a checksum ability to validate that unbroken data has arrived.

Packet Structure:

Format of UDP Datagram

UDP packet structure has two parts – a header and a data segment. Initial 8 Bytes is header containing all required header details and remaining segment contains data. Checksum calculation is optional in UDP, unlike TCP, because UDP depends on IP and ICMP for reporting an error.

Applications of UDP:

UDP is a model protocol for system applications where apparent latency is critical. For example, in games, voice calls or video telecommunications can afford to suffer some loss of data without affecting the quality adversely. In a few cases, forward-error correction methods enhance the audio & video quality despite the data loss.

UDP can also help in applications which require no-loss data transmission by designing the applications which can retransmit the lost data packets and reconstruct received packets into the original order. This technique helps in improving the data transfer speed of big files.

Difference between UDP and TCP

Datagram in UDP is similar to the packet of information. But, it is different from TCP in the sense that this protocol neglects the error checking step while transferring data. This results in speedy data transfer without the repeated communication and delivery guarantee.

 UDP vs TCP

In conclusion, TCP allows high-reliability data exchange whereas UDP helps in low-overhead communications. Highly time-sensitive network apps rely heavily on User Datagram Protocol or UDP as it decreases latency by not reordering data packets or retransmitting lost data.