User Datagram Protocol

User Datagram Protocol: UDP stands for the User Datagram Protocol. UDP was developed by David P Reed in 1980. It is a connection-less and unreliable protocol. In this protocol, when the data transfer occurs, it does not establish the connection between the sender and receiver. It sends the data directly. The receiver does not send any acknowledgment of the receiving data in this protocol. In the UDP, the data packet is called datagram.

UDP does not guarantee any user data, whether it will reach its destination or not. In this protocol, it is not necessary that the data reach the receiver in the same sequencer in which the sender has sent the data.

Importance of UDP

  • The UDP protocol is used to transfer data where you need a higher speed than accuracy and reliability.
  • If the data flow is in the same direction, UDP is used.
  • It is also used for streaming applications, for example, YouTube and online gaming.
  • It provides faster data transfer speed than the TCP protocol.

User Datagram Protocol Format

The UDP format is very simple. The header size of the UDP is 8 bytes (8 bytes mean 64 bits). The format of UDP is shown below in the figure.

User Datagram Protocol

It has four fields shown below:

  • Source Port Number: The size of the source port is 16 bits. It is used to identify the process of the sender.
  • Destination Port Number: The size of the destination port is 16 bits. It is used to identify the process of the receiver.
  • Total length: The size of the total length is 16 bits. It defines the total length of the UDP and also stores the length of the data and header.

                                       UDP length = IP length - IP header's length

  • Checksum: The size of the checksum port is 16 bits. It is used to detect errors across the entire user datagram.

Advantages of UDP 

  1. You can easily broadcast and multicast transmission through the UDP.
  2. It is faster than TCP.
  3. It uses the small size of the header (8 bytes).
  4. It takes less memory than other protocols.
  5. Whenever data packets need to be transmitted, then UDP is used.

Disadvantages of UDP 

  1. It is an unreliable protocol for transmission.
  2. There is no such function in it to know that the data has been received or not.
  3. The handshake method is not used in UDP.
  4. It does not control the congestion.
  5. The main disadvantage of using routers with UDP is that once transmission failure occurs, the routers do not transmit the datagram again.

UDP is used in the following applications.

  1. Domain name system.
  2. Simple network management protocol.
  3. Routing information protocol.
  4. Trivial file transfer protocol.

Services of UDP and TCP

Sequence data deliveryNoYes
Allows half-closed connectionN/AYes
Application PDU bundlingNoYes
Congestion ControlNoYes
Application PDU fragmentationNoYes
Preserve message boundariesYesNo
Partial reliable data transferNoNo
Selective AcknowledgementsNoOptional