The simplest protocol for transport layer communication isUser Datagram Protocol(UDP). It has the bare minimum of communication channels. It is a best-effort delivery protocol that is regarded as unreliable. BecauseUDPdoesn’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 providesprocess to process communication. So today, we are here with one of the simplest protocols ofTransport 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 in1980.
- UDP protocol is theconnectionlessandunreliableprotocol.
- Since UDP is aconnectionless protocolthere is no need to establish a connection before transmitting data.
- User Datagram Protocolgives us a set of rules for transmitting data over the internet.
- UDP packets are calledUser Datagram.
- User Datagram has8 bytesfixed-size header.
- UDPprotocol will work just like an alternative to TCP (Transmission Control Protocol).
- Process can useUDP protocolif they don’t care much about thereliabilityof 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:
- Source port numberis2bytes field that defines the port number of the sender.
- Destination port numberis2bytes field that defines the port number of the destination.
- Packet lengthis also2bytes field for defining the total length of the user datagram(header length+data length)
- Checksumis a2bytes 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 theUDPpacket consisting of four fields.
Features of UDP protocol
Transport layer protocol
- User Datagram Protocolis a transport layer protocol.
- UDP is considered as anunreliableandconnection-lessprotocol
Connectioness
- UDP protocol is aconnectionless protocol, so it does not establish any virtual path before transmitting the data.
- Since it is connectionless, so packets are sent fromdifferentpaths between sender and receiver.
Ordered delivery of data is not guaranteed.
- UDP doesnot guaranteetheorderof the datagram. A datagram can be received in any order
- The UDP protocolutilizesdifferent port numbers for transmitting data to the correct destination.
- The port numbers are defined between0 – 1023.
Faster transmission
- UDP provides us afasterservice of data transmission as there isno prior connection establishmentbefore transmitting the data.
- UDP doesnot requireany virtual path for data transmission.
Acknowledgment mechanism
There isno acknowledgment mechanismprovided by UDP as UDP protocol is a connection-less protocol, so there is no handshaking.
Segments are handled independently.
Every segment in UDP takes adifferentpath to reach the destination. So, every UDP packet is handledindependentof other UDP packets.
Stateless
UDP protocol is astatelessprotocol which means that the sender doesnotwait for an acknowledgment after sending the packet.
Applications of User Datagram Protocol (UDP)
- UDP protocol can beutilizedfor simple request-response communication when there is asmaller sizedata since there is very little concern about the error and flow control.
- UDP carriespacket switching, so UDP is considered a suitable protocol for multicasting.
- UDP is also used in somerouting update protocolssuch asRouting Information Protocol(RIP).
- UDP protocol is generally used forreal-time applicationsthat do not allow unevendelaysbetween received message sections.
- Some of the implementations that useUDPas its transport layer protocol are given below:
- NTP (Network Time Protocol)
- BOOTP, DHCP
- DNS (Domain Name Service)
- Quote of the day protocol
- NNP (Network News Protocol)
- 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. Thefirst queueis theincoming queuethat is used forreceivingthe messages, and thesecond queueis theoutgoing queuethat 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 theUDPpackets:
Refer to the image below to see the concept of queuing in UDP protocol and components used by UDP for sending and receiving packets
- 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, theUDPprotocol useschecksum.
Disadvantages of User Datagram Protocol (UDP)
- UDP is aunreliableprotocol.
- UDP protocol does not providecongestion 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 isno acknowledgmentmechanism in UDP, so the receiver will not acknowledge the sender for the received packet.
Conclusion
- UDP is asimplest transport layer protocol.
- UDP protocol is aconnection-less,unreliabletransport layer protocol.
- User Datagram Protocol packets are calleduser datagram.
- UDP does not provide anyerrorandflow controland acknowledgment mechanism.