User Datagram Protocol (UDP) in Computer Networks

User datagram protocol (UDP) is a transport layer protocol. It is a connectionless, unreliable protocol that has no flow-and-error control. UDP uses port numbers to multiply data from the application layer. UDP is a simple protocol, it has less overhead. Suppose a process wants to send a small message, then UDP would require very little interaction between the sender and the receiver as compared to the transmission control protocol (TCP).

UDP User Datagram Format

UDP packets user datagram has a fixed size header of 8 bytes.

UDP Header − It is an 8-bytes fixed header. The first 8 bytes of a datagram contain necessary header information and the remaining part consists of data. UDP port number fields are each 16-bits or 2-bytes long. Port numbers help to distinguish different user requests or processes.

  • Source Port Number − The source port number is used by the process running on the source host. This port number is 16-bits or 2-bytes long.
  • Destination Port Number − This destination port number is 16- bits long, and it is used by the process running on the destination host.
  • Length − It is a 16-bits field that defines the total length of the user datagram, header plus data.
  • Checksum − Checksum field is used to detect errors over the entire used datagram.

Application of UDP

  • UDP is used for straightforward request/response communications of relatively small amounts of data, eliminating concerns regarding controlling errors or the flow of the packets.
  • It is suitable for multicasting because UDP works well with packet switching.
  • It is a routing update protocol such as Routing Information Protocol (RIP).
  • UDP is a real-time application in which the information needs to be delivered quickly and smoothly.