User Datagram Protocol (UDP)

User Datagram Protocol (UDP) is a simple datagram oriented, transport layer protocol. Each output operation by a process produces exactly one UDP datagram which causes one IP datagram to be sent. UDP provides connectionless and unreliable communication. It receives a datagram from the application layer and sends it to the IP layer. But there is no guarantee that they will ever reach their destination.

User Datagram Protocol (UDP)
A UDP header is shown below:
1. Source and Destination port numbers: It identifies the sending and receiving processes respectively.

2. UDP Length: It’s the length of UDP header plus UDP data, it measured in bytes. So, its minimum value is 8.

3. UDP Checksum: It is used for checking error introduced in UDP header and UDP data parts. This field is optional. UDP checksum covers both the UDP header and UDP data. It adds 16-bit words. So, if the UDP datagram isn’t multiple of 16 bits then a pad byte of 0’s is appended at the end for checksum computation only. This possible pad byte isn’t transmitted. Next, a 12-byte pseudo-header is included with the UDP datagram just for checksum computation. The purpose is to double-check that the data has arrived at the correct destination.

If 0’s is transmitted as a checksum then it indicates that the sender has not computed the checksum. If the sender doesn’t compute the checksum and the receiver detects a checksum error then the UDP datagram is silently discarded without generating any error message.