UDP Protocol

FREE Online Courses: Knowledge Awaits – Click for Free Access!

In 1980, David P. Reed created the UDP protocol. It is a standard protocol over the internet because it is defined in RFC 768 and is a part of the TCP/IP protocol. Using the internet, computer applications exchange messages in the form of datagrams, through UDP.

The UDP protocol is an alternative to the TCP protocol for communication (transmission control protocol). UDP, like TCP, defines a set of rules for how data should be transmitted over the internet. The UDP encapsulates the data in the packet and adds its own header information. The UDP packet is then encapsulated in an IP packet and sent to its intended destination.

Because the TCP and UDP protocols both send data over the internet protocol network, they are referred to as TCP/IP and UDP/IP, respectively. There are numerous distinctions between the two protocols. UDP allows processes to communicate with each other, whereas TCP allows hosts to communicate with each other.

UDP is considered the best-effort mode of communication because it sends messages in the form of datagrams. TCP is a reliable transport medium because it sends individual packets. Another distinction is that TCP is a connection-oriented protocol, whereas UDP is a connectionless protocol, requiring no virtual circuit to transfer data.

UDP uses a unique port number to separate different user requests, and has checksum capability to verify whether all of the data has arrived; the IP layer does not provide these two services.

Features of UDP Protocol:

1. Transport Layer Protocol:

The most basic transport layer communication protocol is UDP. It only has the bare minimum of communication mechanisms. It is based on best-effort delivery services and is considered an unreliable protocol. UDP has no acknowledgment mechanism, so the receiver does not send an acknowledgment for the packet it has received, and the sender does not wait for an acknowledgement for the packet it has sent.

2. Connectionless:

Because it does not create a virtual path to transfer data, UDP is a connectionless protocol. Because it does not use the virtual path, packets are sent in different paths between the sender and the receiver, resulting in packet loss or out-of-order reception.

3. Ordered Delivery not guaranteed:

Because UDP datagrams are not numbered, the order in which they are sent does not guarantee that they will be received in the same order.

4. Ports:

The UDP protocol employs different port numbers to ensure that data is delivered to the intended recipient. Between 0 and 1023 are assigned port numbers.

5. Higher Transmission Speed:

Because UDP is a connectionless protocol, no virtual path is required to transfer data, it allows for faster transmission. However, there is a chance that an individual packet will be lost, lowering transmission quality. On the other hand, if a packet is lost in a TCP connection, it will be resent, ensuring that data packets are delivered.

6. Acknowledgement Procedure:

There is no acknowledgement mechanism in place for UDP, which means there is no handshaking between the sender and receiver. If the message is sent over TCP, the receiver acknowledges that I am ready, and the sender then sends the data. In TCP, handshaking takes place between the sender and the receiver, whereas in UDP, no handshaking takes place between the sender and the receiver.

7. Independent Handling of Segments:

Each UDP segment is treated independently of the others because each segment follows a different path to its destination. Because there is no connection established between the sender and the receiver, the UDP segments may be lost or delivered out of order to reach the destination.

8. Stateless:

It is a stateless protocol, which means that the sender does not receive an acknowledgement for each packet sent.

Need for UDP Protocol:

Although we know that UDP is an unreliable protocol, it is still required in some situations. UDP is used when the packets, as well as the data, require a large amount of bandwidth. Recognizing thousands of packets, for example, is inconvenient and wastes a lot of bandwidth in video streaming. In the case of video streaming, the loss of a few packets is unlikely to cause any issues, and it can be overlooked.

UDP Header:

udp header

1. Source Port Number:

It is a 16-bit value that indicates which port will send the packet.

2. Destination Port Number:

It determines which port will be used to receive the data. It is a 16-bit field that’s used on the destination machine to identify application-level services.

3. Length:

It is a 16-bit field that specifies the length of the entire UDP packet, including the header. Because the header is 8 bytes long, the minimum value is 8 bytes.

4. Checksum:

It is a 16-bit field that can be turned on or off. This checksum field determines whether the information is correct or not, as data can be corrupted during transmission. It is an optional field, which means that the application must decide whether or not to write the checksum. If it doesn’t want to write the checksum, all 16 bits are set to zero; otherwise, the checksum is written. The checksum field is applied to the entire packet in UDP, including the header and data, whereas it is only applied to the header field in IP.

Queues in UDP Protocol:

Numbers are used in the UDP protocol to distinguish between different processes on a server and client. We already know that UDP is a protocol for transferring data. The processes that require services are generated by the client, while the processes that provide services are generated by the server. Both processes have their own queues, so there are two queues for each process.

The first is the incoming queue, which receives messages, and the second is the outgoing queue, which sends them. When the process is running, the queue performs its functions. When a process is terminated, the queue is destroyed as well.

The components involved in queuing in UDP are:

1. Input queue:

Each process involving the UDP packets uses a set of queues.

2. Input module:

This module obtains the user datagram from the IP address and then searches the control block table of the same port for information. It enqueues the data if it finds an entry in the control block table with the same port as the user datagram.

3. Control Block Module:

The control block table is managed by it.

4. Control Block Table:

The entry of open ports is stored in the control block table.

5. Output Module:

The user datagram is created and sent by the output module.

Advantages of UDP:

1. It generates a small amount of overhead.

Disadvantages of UDP:

1. It offers a connection delivery service that is unreliable. It only provides process-to-process communication and does not provide any IP services.

2. The UDP message could be misplaced, delayed, duplicated, or out of order.

3. UDP lacks a dependable transportation delivery service. It doesn’t have any kind of acknowledgement or flow control system. It does, however, provide some level of error control.

Summary:

In this article, we looked at the User Datagram Protocol (UDP) in detail, and explored the features of this protocol. We took a brief look at the queueing system used in UDP, and the structure of the UDP Header. Lastly, we looked at the advantages and disadvantages of the UDP Protocol.

Did you like this article? If Yes, please give DataFlair 5 Stars on Google

follow dataflair on YouTube

Leave a Reply

Your email address will not be published. Required fields are marked *