Trapti Gupta

User Datagram Protocol (UDP)

The simplest protocol for transport layer communication is User Datagram Protocol (UDP). It has the bare minimum of communication channels. It is a best-effort delivery protocol that is regarded as unreliable. Because UDP doesn’t offer an acknowledgment mechanism, neither the sender nor the receiver sends an acknowledgment for a packet that has been received or sent.

What is User Datagram Protocol (UDP)?

There are many transport layer protocols. The transport layer provides process to process communication. So today, we are here with one of the simplest protocols of Transport Layer.

Note: UDP protocol is the connection-less transport layer protocol, and also it is an unreliable protocol.**

  • User Datagram Protocol was developed by David P. Reed in 1980.
  • UDP protocol is the connectionless and unreliable protocol.
  • Since UDP is a connectionless protocol there is no need to establish a connection before transmitting data.
  • User Datagram Protocol gives us a set of rules for transmitting data over the internet.
  • UDP packets are called User Datagram.
  • User Datagram has 8 bytes fixed-size header.
  • UDP protocol will work just like an alternative to TCP (Transmission Control Protocol).
  • Process can use UDP protocol if they don’t care much about the reliability of transmission and want to send a small message.

Working of UDP protocol

  • UDP works by collecting data in a UDP packet, and in the packet, it adds its own header information.
  • UDP packet, called user datagram, consists of:
    1. Source port number is 2 bytes field that defines the port number of the sender.
    2. Destination port number is 2 bytes field that defines the port number of the destination.
    3. Packet length is also 2 bytes field for defining the total length of the user datagram(header length+data length)
    4. Checksum is a 2 bytes optional field for carrying checksum
  • UDP packets are sent to their destination after encapsulating it in an IP packet
  • In UDP, there is no acknowledgment generated for the packet received, so the sender does not wait for acknowledgment of the sent packet.

Refer to the image below to see the header of the UDP packet consisting of four fields.

Working of UDP protocol

Features of UDP protocol

Transport layer protocol

  • User Datagram Protocol is a transport layer protocol.
  • UDP is considered as an unreliable and connection-less protocol

Connectioness

  • UDP protocol is a connectionless protocol, so it does not establish any virtual path before transmitting the data.
  • Since it is connectionless, so packets are sent from different paths between sender and receiver.

Ordered delivery of data is not guaranteed.

  • UDP does not guarantee the order of the datagram. A datagram can be received in any order
  • The UDP protocol utilizes different port numbers for transmitting data to the correct destination.
  • The port numbers are defined between 0 – 1023.

Faster transmission

  • UDP provides us a faster service of data transmission as there is no prior connection establishment before transmitting the data.
  • UDP does not require any virtual path for data transmission.

Acknowledgment mechanism

There is no acknowledgment mechanism provided by UDP as UDP protocol is a connection-less protocol, so there is no handshaking.

Segments are handled independently.

Every segment in UDP takes a different path to reach the destination. So, every UDP packet is handled independent of other UDP packets.

Stateless

UDP protocol is a stateless protocol which means that the sender does not wait for an acknowledgment after sending the packet.

Applications of User Datagram Protocol (UDP)

  • UDP protocol can be utilized for simple request-response communication when there is a smaller size data since there is very little concern about the error and flow control.
  • UDP carries packet switching, so UDP is considered a suitable protocol for multicasting.
  • UDP is also used in some routing update protocols such as Routing Information Protocol(RIP).
  • UDP protocol is generally used for real-time applications that do not allow uneven delays between received message sections.
  • Some of the implementations that use UDP as its transport layer protocol are given below:
    1. NTP (Network Time Protocol)
    2. BOOTP, DHCP
    3. DNS (Domain Name Service)
    4. Quote of the day protocol
    5. NNP (Network News Protocol)
    6. TFTP, RTSP, RIP

Concept of Queuing in UDP

In User Datagram protocol (UDP), different processes on the network are distinguished by using numbers. We are already aware that UDP provides the process to process communication. The processes that require services are generated by the client. On the other hand, the processes that provide services are generated by the server. For both processes, queues are available. The first queue is the incoming queue that is used for receiving the messages, and the second queue is the outgoing queue that is used for sending the messages. When the process is in a running state, then only the queue functions and the queue will get destroyed with the termination of the process. UDP uses the following components for handling the sending and receiving of the UDP packets:

Refer to the image below to see the concept of queuing in UDP protocol and components used by UDP for sending and receiving packets

Concept of Queuing in UDP
  • Input queue: For each process, UDP packets use a set of queues.
  • Input module: The input module from the IP takes the user datagram, and then it identifies the information from the control block table of the same port. If it successfully finds any entry in the control block table with the same port as the user datagram, it enqueues the data.
  • Control Block Module: Control block table is managed by this.
  • Control Block Table: It contains the entry of open ports.
  • Output module: Used for creating and sending the user datagram.

Advantages of User Datagram Protocol (UDP)

  • UDP produces a minimal number of overheads for data transmission.
  • UDP is the simplest transport layer protocol.
  • UDP protocol uses packets of smaller size.
  • User Datagram provides faster delivery of data as there is no acknowledgment mechanism in UDP.
  • For error detection, the UDP protocol uses checksum.

Disadvantages of User Datagram Protocol (UDP)

  • UDP is a unreliable protocol.
  • UDP protocol does not provide congestion control service.
  • It does not guarantee the order of data received as there is no concept of windowing in UDP.
  • Flow control is also not provided by UDP protocol.
  • There is no acknowledgment mechanism in UDP, so the receiver will not acknowledge the sender for the received packet.

Conclusion

  • UDP is a simplest transport layer protocol.
  • UDP protocol is a connection-less, unreliable transport layer protocol.
  • User Datagram Protocol packets are called user datagram.
  • UDP does not provide any error and flow control and acknowledgment mechanism.

Author