In this tutorial, we will be covering the transport layer protocol i.e, UDP in Computer Networks.
UDP is a short form for User Datagram protocol. It is one of the simplest transport layer protocol. It is a connectionless and unreliable transport protocol.
This protocol is mainly designed in order to data send data packets over the Internet.
This protocol does not add anything to the services of IP(Internet protocol) except that UDP provides process-to-process communication rather than host-to-host communication.
UDP performs a very limited amount of error checking.
This protocol uses the minimum number of overhead. Suppose if a process wants to send a small message with no concern of reliability then it can make the use of UDP.
This protocol simply takes the datagram from the network layer, attaches its own header, and then sends it back to the user.
The UDP packets are commonly known as User Datagram and the size of the header is fixed that is 8 bytes.
Let us now take a look at the format of User Datagram;
1.Source Port Number
This port number is mainly used by the process that is running on the source host. Its length is 16 bits which means that the port number can range from 0 to 65,535. It is mainly used to identify the port of the sending or source application.
In case if the source host is a client (that mainly sends a request), then in most cases the ephemeral port number is requested by the process and also chosen by UDP software that runs on the source host.
But in the case of the server as a source host(mainly a server sending a response) then the port number is a well-known port number in such cases.
2.Destination Port Number
This port number is mainly used by the process that is running on the destination host. Its length is 16 bits.
If the destination host is the server ( a client sending the request), then the port number is a well-known port number.
In case if the destination host is a client( server sending the response), then in most cases the port number is an ephemeral port number.
This field of the datagram header is mainly used to identify the combined length of UDP Header and Encapsulated data. It is a 16-bit field.
UDP Length= Length of UDP header + Length of Encapsulated data
This field is mainly used to detect errors. It is a 16-bit field.
- The checksum calculation is although not mandatory in the User datagram protocol.
Characteristics of UDP
Given below are some of the characteristics of the User Datagram protocol:
UDP is an unreliable and connectionless protocol.
It is almost a Null Protocol.
If the flow of data is in one direction, then it is a good protocol.
This protocol does not guarantee the delivery of the data.
No congestion control mechanism is provided by this protocol.
UDP offers Minimal transport services.
It is a stateless protocol.
Operation of UDP
Given below are different operations of UDP:
The User datagram protocol offers Connectionless Services which simply means that each user datagram that is sent by the UDP is an independent datagram. In different datagrams, there is no relationship, even if they are coming from the same source process and also going to the same destination program.
User datagrams are not numbered, there is no connection establishment and no connection termination.
Each datagram mainly travels through different paths.
2.Flow Control and Error Control
User datagram is a very simple and unreliable transport protocol. It does not provide any flow control mechanism and hence there is no window mechanism. Due to which the receiver may overflow with the incoming messages.
No error control mechanism is provided by UDP except checksum. Due to which the sender does not know if any message is has been lost or duplicated.
As there is a lack of flow control and error control it means that the process that uses the UDP should provide these mechanisms.
3.Encapsulation and decapsulation
In order to send the message from one process to another, the user datagram protocol encapsulates and decapsulates the message in the form of an IP datagram.
Applications of UDP
Given below are some applications of the User datagram protocol:
UDP is used by those applications that require one response for one request.
It is used by broadcasting and multicasting applications.
Management processes such as SNMP make use of UDP.
Route updating protocols like Routing Information Protocol(RIP) make use of User Datagram Protocol.
The process that has an error and flows control mechanism makes use of UDP. One Application for the same is Trivial File Transfer Protocol(TFTP).
Well-known UDP Ports
Now its time to take a look at some well know port numbers used by User datagram protocol:
|7||Echo||This port echoes a received datagram back to the sender.|
|9||Discard||It is used to discard any datagram that is received.|
|11||Users||Indicates Active Users|
|13||Daytime||Used to return the date and time|
|17||Quote||Used to return the Quote of the day|
|19||Chargen||Used to return a string of Characters.|
|53||Nameserver||Indicates the Domain name service|
|67||BOOTPs||Server port used to download the bootstrap information.|
|68||BOOTPc||Client port used to download the bootstrap information.|
|69||TFTP||Trivial file transfer protocol|
|111||RPC||Remote Procedure call|
|123||NTP||Network time protocol|
|161||SNMP||Simple Network Management Protocol|
|162||SNMP||Simple Network Management Protocol(trap)|
Queuing concept in User Datagram Protocol
In User datagram protocol, generally, queues are associated with ports:
The incoming queue is mainly used for receiving the messages, while the outgoing queue is mainly used for sending the messages. Queue mainly functions at the time when the process is in a running state when the process terminates, then the queue gets destroyed at the same time.
There are several processes that want to use the services provided by UDP.
User datagram protocol mainly multiplexes and demultiplexes the processes in order to run multiple processes on a single host.
Advantages of UDP
Given below are some advantages of UDP:
With UDP, broadcast and multicast transmission is possible.
UDP uses the bandwidth efficiently, as there is a small packet overhead.
As there is no need for connection establishment, hence UDP is very fast.
There is no buffering and numbering of packets.
There is no need for handshaking.
There is no congestion control so it is used for real-time applications.
Disadvantages of UDP
Now its time to take a look at UDP:
1.There is a lack of guaranteed delivery.
2.There is no flow control.
3.There is no congestion control mechanism.