Now lets start with the 1st protocol of Transport Layer i.e. User Datagram Protocol(UDP). UDP is one of the most important protocol in the Transport Layer providing services to the Internet. The UDP was first ever developed by David P. Reed in 1980. UDP is used by Transport Layer to pass the messages from Application Layer to the underlying Network Layer.
UDP is a Connection-Less protocol. This means that there is no handshaking between the two hosts before transmission of packets. UDP provides no guarantee for the delivery of packets. As transport layer works over Network Layer. Thus, UDP working over IP , that is also an unreliable data delivery. Therefore in case of UDP , you cannot be sure about the delivery of message. UDP just provides simple multiplexing and demultiplexing at hosts and a checksum for data integrity at both the hosts.
Checksum is a procedure or you can say that it is a mathematical calculation, that is done at both the sending and the receiving host, in order to check that, whether the data has arrived in its original form or not. It checks the correctness of the received data.
**** Now a question must be arising in your mind. That, if UDP doesn’t provides any guarantee of transfer of packets, it doesn’t provide any flow control, then why should a developer use UDP for his Application??
Let me tell you some uses of UDP and why should a Application Developer uses UDP for his Application.
There are various uses of UDP. These are as follows:
1. Stateless Protocol :
2. No Re-transmission Delay :
3. Suitable for DNS:
4. Small Header :
Working of User Datagram Protocol(UDP):
UDP is really helpful in real time Applications such as, Video Conferencing , Online Gaming etc. Because in such Applications, losing packets is preferable than getting Delayed.
Ports are identified by a port number. A Port Number is a 16 bit number i.e a port number can be assigned from 0 to 65535 to an Application. Port Number from 0 to 1023 are registered for the IANA registered services such as HTTP, FTP, TCP etc. and port Numbers from 1024 to 65535 are dynamic, that means, a newly developed application can be assigned port number among these.
UDP Packet Structure:
The UDP Header has 4 fields . Each field is of 16 bit or 2 bytes. Thus UDP header length is 8 bytes or 32 bits.
******** 1 byte= 8 bits *********
1.Source and Destination Port Number
It tells you the complete length of the UDP Packet i.e Length = UDP header + Application Message length. Thus for different UDP segments, length will be different, depending upon the size of the Application Message.
Minimum Length will be 8 bytes i.e. the size of the header.
Checksum is used for Error Detection.
Source Port Number (S) = 0001101110010101
Length (L) = 0011011110010001
+ 1100010100001000 = T
+ 1111110010011001 = A
Now we will take the 1’s complement of A, i.e converting all 1’s to 0 and all 0’s to 1.
If the data has arrived him correctly, then the sum will be equal to 1111111111111111. That is , he will get all 1’s after adding the 4 fields. And if he gets 0 at some bit , that will show him the error.
- You can see that UDP provides error checking, but it doesn’t provide anything to recover from that error. Some UDP applications will discard the packet with an error, and some will pass the packet to the Application with a given warning.
Thank You for reading the article . We hope you enjoyed it.
This was all from us on User Datagram Protocol(UDP). Do you have any information to share with our readers ?