0% found this document useful (0 votes)
36 views14 pages

Understanding User Datagram Protocol (UDP)

The document discusses the User Datagram Protocol (UDP), highlighting its characteristics as a simple, connectionless, and unreliable transport layer protocol used for applications like video streaming, online gaming, and VoIP. It explains the structure of the UDP header, its advantages such as speed and lower latency, and its limitations including lack of reliability and congestion control. Additionally, it covers Remote Procedure Calls (RPC) and the principles of reliable data transfer protocols, emphasizing the need for reliable communication in layered architectures.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views14 pages

Understanding User Datagram Protocol (UDP)

The document discusses the User Datagram Protocol (UDP), highlighting its characteristics as a simple, connectionless, and unreliable transport layer protocol used for applications like video streaming, online gaming, and VoIP. It explains the structure of the UDP header, its advantages such as speed and lower latency, and its limitations including lack of reliability and congestion control. Additionally, it covers Remote Procedure Calls (RPC) and the principles of reliable data transfer protocols, emphasizing the need for reliable communication in layered architectures.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Subject: Computer Networks(P2) Class: [Link]-V sem(nep) Notes by: Ms. S. P.

Gotur
UNIT-5 10 Hrs
User Datagram Protocol (UDP): User Datagram, UDP Operations, Uses of UDP, RPC, Principles of Reliable
Data Transfer: Building a Reliable Data Transfer Protocol, Pipelined Reliable Data Transfer Protocol, Go Back-
N(GBN), Selective Repeat (SR). Application layer : Functions of Application layer, Application Layer Protocols:
DNS, DHCP, WWW, HTTP, HTTPs, TELNET, FTP, SMTP, POP, IIMAP.

User Datagram Protocol


The User Datagram Protocol (UDP) is simplest Transport Layer communication protocol
available of the TCP/IP protocol suite. It involves minimum amount of communication
mechanism. UDP is said to be an unreliable transport protocol but it uses IP services which
provides best effort delivery mechanism.

In UDP, the receiver does not generate an acknowledgement of packet received and in turn,
the sender does not wait for any acknowledgement of packet sent. This shortcoming makes
this protocol unreliable as well as easier on processing.

Requirement of UDP

A question may arise, why do we need an unreliable protocol to transport the data? We
deploy UDP where the acknowledgement packets share significant amount of bandwidth
along with the actual data. For example, in case of video streaming, thousands of packets are
forwarded towards its users. Acknowledging all the packets is troublesome and may contain
huge amount of bandwidth wastage. The best delivery mechanism of underlying IP protocol
ensures best efforts to deliver its packets, but even if some packets in video streaming get
lost, the impact is not calamitous and can be ignored easily. Loss of few packets in video and
voice traffic sometimes goes unnoticed.

Features
• UDP is used when acknowledgement of data does not hold any significance.
• UDP is good protocol for data flowing in one direction.
• UDP is simple and suitable for query based communications.
• UDP is not connection oriented.
• UDP does not provide congestion control mechanism.
• UDP does not guarantee ordered delivery of data.
• UDP is stateless.
• UDP is suitable protocol for streaming applications such as VoIP, multimedia
streaming.
UDP Header

UDP header is as simple as its function.


UDP header contains four main parameters:

• Source Port - This 16 bits information is used to identify the source port of the packet.
• Destination Port - This 16 bits information, is used identify application level service
on destination machine.
• Length - Length field specifies the entire length of UDP packet (including header). It
is 16-bits field and minimum value is 8-byte, i.e. the size of UDP header itself.
• Checksum - This field stores the checksum value generated by the sender before
sending. IPv4 has this field as optional so when checksum field does not contain any
value it is made 0 and all its bits are set to zero.
UDP applications

Here are few applications where UDP is used to transmit data:

• Domain Name Services


• Simple Network Management Protocol
• Trivial File Transfer Protocol
• Routing Information Protocol
• Kerberos

User Datagram Protocol (UDP) is a Transport Layer protocol. UDP is a part of the Internet
Protocol suite, referred to as UDP/IP suite. Unlike TCP, it is an unreliable and connectionless
protocol. So, there is no need to establish a connection prior to data transfer. The UDP helps to
establish low-latency and loss-tolerating connections establish over the [Link] UDP
enables process to process communication.

Though Transmission Control Protocol (TCP) is the dominant transport layer protocol used
with most of the Internet services; provides assured delivery, reliability, and much more but all
these services cost us additional overhead and latency. Here, UDP comes into the picture. For
real-time services like computer gaming, voice or video communication, live conferences; we
need UDP. Since high performance is needed, UDP permits packets to be dropped instead of
processing delayed packets. There is no error checking in UDP, so it also saves bandwidth.
User Datagram Protocol (UDP) is more efficient in terms of both latency and bandwidth.

UDP Header –

UDP header is an 8-bytes fixed and simple header, while for TCP it may vary from 20 bytes to
60 bytes. The first 8 Bytes contains all necessary header information and the remaining part
consist of data. UDP port number fields are each 16 bits long, therefore the range for port
numbers is defined from 0 to 65535; port number 0 is reserved. Port numbers help to
distinguish different user requests or processes.

1. Source Port: Source Port is a 2 Byte long field used to identify the port number of the
source.
2. Destination Port: It is a 2 Byte long field, used to identify the port of the destined packet.
3. Length: Length is the length of UDP including the header and the data. It is a 16-bits field.
4. Checksum: Checksum is 2 Bytes long field. It is the 16-bit one’s complement of the one’s
complement sum of the UDP header, the pseudo-header of information from the IP header,
and the data, padded with zero octets at the end (if necessary) to make a multiple of two
octets.

Notes – Unlike TCP, the Checksum calculation is not mandatory in UDP. No Error control or
flow control is provided by UDP. Hence UDP depends on IP and ICMP for error
reporting. Also UDP provides port numbers so that is can differentiate between users requests.

Applications of UDP:
• Used for simple request-response communication when the size of data is less and hence
there is lesser concern about flow and error control.
• It is a suitable protocol for multicasting as UDP supports packet switching.
• UDP is used for some routing update protocols like RIP(Routing Information Protocol).
• Normally used for real-time applications which can not tolerate uneven delays between
sections of a received message.
• UDP is widely used in online gaming, where low latency and high-speed communication is
essential for a good gaming experience. Game servers often send small, frequent packets of
data to clients, and UDP is well suited for this type of communication as it is fast and
lightweight.
• Streaming media applications, such as IPTV, online radio, and video conferencing, use
UDP to transmit real-time audio and video data. The loss of some packets can be tolerated
in these applications, as the data is continuously flowing and does not require
retransmission.
• VoIP (Voice over Internet Protocol) services, such as Skype and WhatsApp, use UDP for
real-time voice communication. The delay in voice communication can be noticeable if
packets are delayed due to congestion control, so UDP is used to ensure fast and efficient
data transmission.
• DNS (Domain Name System) also uses UDP for its query/response messages. DNS queries
are typically small and require a quick response time, making UDP a suitable protocol for
this application.
• DHCP (Dynamic Host Configuration Protocol) uses UDP to dynamically assign IP
addresses to devices on a network. DHCP messages are typically small, and the delay
caused by packet loss or retransmission is generally not critical for this application.
• Following implementations uses UDP as a transport layer protocol:

• NTP (Network Time Protocol)


• DNS (Domain Name Service)
• BOOTP, DHCP.
• NNP (Network News Protocol)
• Quote of the day protocol
• TFTP, RTSP, RIP.
• The application layer can do some of the tasks through UDP-

• Trace Route
• Record Route
• Timestamp
• UDP takes a datagram from Network Layer, attaches its header, and sends it to the user. So,
it works fast.
• Actually, UDP is a null protocol if you remove the checksum field.
1. Reduce the requirement of computer resources.
2. When using the Multicast or Broadcast to transfer.
3. The transmission of Real-time packets, mainly in multimedia applications.
Advantages of UDP:
1. Speed: UDP is faster than TCP because it does not have the overhead of establishing a
connection and ensuring reliable data delivery.
2. Lower latency: Since there is no connection establishment, there is lower latency and faster
response time.
3. Simplicity: UDP has a simpler protocol design than TCP, making it easier to implement and
manage.
4. Broadcast support: UDP supports broadcasting to multiple recipients, making it useful for
applications such as video streaming and online gaming.
5. Smaller packet size: UDP uses smaller packet sizes than TCP, which can reduce network
congestion and improve overall network performance.
Disadvantages of UDP:
1. No reliability: UDP does not guarantee delivery of packets or order of delivery, which can
lead to missing or duplicate data.
2. No congestion control: UDP does not have congestion control, which means that it can send
packets at a rate that can cause network congestion.
3. No flow control: UDP does not have flow control, which means that it can overwhelm the
receiver with packets that it cannot handle.
4. Vulnerable to attacks: UDP is vulnerable to denial-of-service attacks, where an attacker can
flood a network with UDP packets, overwhelming the network and causing it to crash.
5. Limited use cases: UDP is not suitable for applications that require reliable data delivery,
such as email or file transfers, and is better suited for applications that can tolerate some data
loss, such as video streaming or online gaming.
UDP PSEUDO HEADER:
• the purpose of using a pseudo-header is to verify that the UDP packet has reached its correct
destination
• the correct destination consist of a specific machine and a specific protocol port number
within that machine

UDP pseudo header

UDP pseudo header details:


• the UDP header itself specify only protocol port [Link] , to verify the destination UDP
on the sending machine computes a checksum that covers the destination IP address as well
as the UDP packet.
• at the ultimate destination, UDP software verifies the checksum using the destination IP
address obtained from the header of the IP packet that carried the UDP message.
• if the checksum agrees, then it must be true that the packet has reached the intended
destination host as well as the correct protocol port within that host.
User Interface:
A user interface should allow the creation of new receive ports, receive operations on the
receive ports that returns the data octets and an indication of source port and source address,
and an operation that allows a datagram to be sent, specifying the data, source and destination
ports and address to be sent.
IP Interface:
• the UDP module must be able to determine the source and destination internet address and
the protocol field from internet header
• one possible UDP/IP interface would return the whole internet datagram including the entire
internet header in response to a receive operation
• such an interface would also allow the UDP to pass a full internet datagram complete with
header to the IP to send. the IP would verify certain fields for consistency and compute the
internet header checksum.
• The IP interface allows the UDP module to interact with the network layer of the protocol
stack, which is responsible for routing and delivering data across the network.
• The IP interface provides a mechanism for the UDP module to communicate with other
hosts on the network by providing access to the underlying IP protocol.
• The IP interface can be used by the UDP module to send and receive data packets over the
network, with the help of IP routing and addressing mechanisms.
• The IP interface provides a level of abstraction that allows the UDP module to interact with
the network layer without having to deal with the complexities of IP routing and addressing
directly.
• The IP interface also handles fragmentation and reassembly of IP packets, which is
important for large data transmissions that may exceed the maximum packet size allowed by
the network.
• The IP interface may also provide additional services, such as support for Quality of Service
(QoS) parameters and security mechanisms such as IPsec.
• The IP interface is a critical component of the Internet Protocol Suite, as it enables
communication between hosts on the internet and allows for the seamless transmission of
data packets across the network.

Remote Procedure Call (RPC)


A remote procedure call is an interprocess communication technique that is used for client-server based
applications. It is also known as a subroutine call or a function call.

A client has a request message that the RPC translates and sends to the server. This request may be a procedure
or a function call to a remote server. When the server receives the request, it sends the required response back
to the client. The client is blocked while the server is processing the call and only resumed execution after the
server is finished.

The sequence of events in a remote procedure call are given as follows −

• The client stub is called by the client.


• The client stub makes a system call to send the message to the server and puts the parameters in the
message.
• The message is sent from the client to the server by the client’s operating system.
• The message is passed to the server stub by the server operating system.
• The parameters are removed from the message by the server stub.
• Then, the server procedure is called by the server stub.

A diagram that demonstrates this is as follows −


Advantages of Remote Procedure Call

Some of the advantages of RPC are as follows −

• Remote procedure calls support process oriented and thread oriented models.
• The internal message passing mechanism of RPC is hidden from the user.
• The effort to re-write and re-develop the code is minimum in remote procedure calls.
• Remote procedure calls can be used in distributed environment as well as the local environment.
• Many of the protocol layers are omitted by RPC to improve performance.

Disadvantages of Remote Procedure Call

Some of the disadvantages of RPC are as follows −

• The remote procedure call is a concept that can be implemented in different ways. It is not a standard.
• There is no flexibility in RPC for hardware architecture. It is only interaction based.
• There is an increase in costs because of remote procedure call.

Principle Of Reliable Data Transfer Protocol


are central piece of layered architectures, these provides the logical communication between
application processes. These processes uses the logical communication to transfer data from
transport layer to network layer and this transfer of data should be reliable and secure. The data
is transferred in the form of packets but the problem occurs in reliable transfer of data. The
problem of transferring the data occurs not only at the transport layer, but also at the
application layer as well as in the link layer. This problem occur when a reliable service runs
on an unreliable service, For example, TCP (Transmission Control Protocol) is a reliable data
transfer protocol that is implemented on top of an unreliable layer, i.e., Internet Protocol (IP) is
an end to end network layer protocol.

Figure: Study of Reliable Data Transfer

In this model, we have design the sender and receiver sides of a protocol over a reliable
channel. In the reliable transfer of data the layer receives the data from the above layer breaks
the message in the form of segment and put the header on each segment and transfer. Below
layer receives the segments and remove the header from each segment and make it a packet by
adding to header. The data which is transferred from the above has no transferred data bits
corrupted or lost, and all are delivered in the same sequence in which they were sent to the
below layer this is reliable data transfer protocol. This service model is offered by TCP to the
Internet applications that invoke this transfer of data.

Figure: Study of Unreliable Data Transfer

Similarly in an unreliable channel we have design the sending and receiving side. The sending
side of the protocol is called from the above layer to rdt_send() then it will pass the data that is
to be delivered to the application layer at the receiving side (here rdt-send() is a function for
sending data where rdt stands for reliable data transfer protocol and _send() is used for the
sending side). On the receiving side, rdt_rcv() (rdt_rcv() is a function for receiving data where -
rcv() is used for receiving side), will be called when a packet arrives from the receiving side of
the unreliable channel. When the rdt protocol wants to deliver data to the application layer, it
will do so by calling deliver_data() (where deliver_data() is a function for delivering data to
upper layer). In reliable data transfer protocol, we only consider the case of unidirectional data
transfer, that is transfer of data from the sending side to receiving side(i.e. only in one
direction). In case of bidirectional (full duplex or transfer of data on both the sides) data
transfer is conceptually more difficult. Although we only consider unidirectional data transfer
but it is important to note that the sending and receiving sides of our protocol will needs to
transmit packets in both directions, as shown in above figure. In order to exchange packets
containing the data that is needed to be transferred the both (sending and receiving) sides of rdt
also need to exchange control packets in both direction (i.e., back and forth), both the sides of
rdt send packets to the other side by a call to udt_send() (udt_send() is a function used for
sending data to other side where udt stands for unreliable data transfer protocol).
Application layer : Functions of Application layer, Application Layer Protocols: DNS, DHCP, WWW, HTTP,
HTTPs, TELNET, FTP, SMTP, POP, IIMAP.

Application layer:

This is the highest layer of the Open System Interconnection (OSI) architecture. The application program's layer
view is a user-oriented layer that offers the services to the end-user of a web.

A message to be transmitted across the web introduces the OSI model and then traverses down into the physical
layer. This is followed by sending a line up to the physical layer of destination and then upwards up to the
receiver end system's application layers.

It offers services that support customer applications, including database creation, messages, and document
transfer.

There are famous application layer protocols are X.400 (Electronic Mail Protocol), X.500 (Directory Server
Protocol), FTP (File Transfer Protocol), and rlogin (Remote Login Protocol).

The figure given below demonstrates the connection of the application layer to the user and the presentation
layer −

Functions of application layer

The functions of application layer are explained below −

• User Interface: It represents the user interface to low-level layers and multiple application processes.
• Security: It is responsible for the execution of the security tests at the user entity points.
• File Transfer: The application layer supports the file transfer access and management (FTAM). It
enables customers to create files in a remote system to retrieve the documents from a remote system
and to handle or control the files in a remote system.
• E-mail: It supports a basis for email forwarding and string.
• Database Access: It supports distributed database sources and global data about several objects and
functions.
• Addressing: It is used for the connection between user and server. There is a requirement for
addressing. When a user requests the server, the request includes the server address and its address. The
server responds to the user request and the request consists of the destination address, i.e., client address.
• Directory Services: An application includes a distributed database that supports the global data about
multiple objects and functions.

Application Layer Protocols: DNS, DHCP, WWW, HTTP, HTTPs, TELNET, FTP, SMTP, POP,
IIMAP

There are several protocols which work for users in Application Layer. Application layer
protocols can be broadly divided into two categories:

• Protocols which are used by [Link] email for example, eMail.


• Protocols which help and support protocols used by [Link] example DNS.

Few of Application layer protocols are described below:

Domain Name System

The Domain Name System (DNS) works on Client Server model. It uses UDP protocol for
transport layer communication. DNS uses hierarchical domain based naming scheme. The
DNS server is configured with Fully Qualified Domain Names (FQDN) and email addresses
mapped with their respective Internet Protocol addresses.

A DNS server is requested with FQDN and it responds back with the IP address mapped with
it. DNS uses UDP port 53.

Simple Mail Transfer Protocol

The Simple Mail Transfer Protocol (SMTP) is used to transfer electronic mail from one user
to another. This task is done by means of email client software (User Agents) the user is
using. User Agents help the user to type and format the email and store it until internet is
available. When an email is submitted to send, the sending process is handled by Message
Transfer Agent which is normally comes inbuilt in email client software.
Message Transfer Agent uses SMTP to forward the email to another Message Transfer Agent
(Server side). While SMTP is used by end user to only send the emails, the Servers normally
use SMTP to send as well as receive emails. SMTP uses TCP port number 25 and 587.

Client software uses Internet Message Access Protocol (IMAP) or POP protocols to receive
emails.

File Transfer Protocol

The File Transfer Protocol (FTP) is the most widely used protocol for file transfer over the
network. FTP uses TCP/IP for communication and it works on TCP port 21. FTP works on
Client/Server Model where a client requests file from Server and server sends requested
resource back to the client.

FTP uses out-of-band controlling i.e. FTP uses TCP port 20 for exchanging controlling
information and the actual data is sent over TCP port 21.

The client requests the server for a file. When the server receives a request for a file, it opens
a TCP connection for the client and transfers the file. After the transfer is complete, the server
closes the connection. For a second file, client requests again and the server reopens a new
TCP connection.

Post Office Protocol (POP)

The Post Office Protocol version 3 (POP 3) is a simple mail retrieval protocol used by User
Agents (client email software) to retrieve mails from mail server.

When a client needs to retrieve mails from server, it opens a connection with the server on
TCP port 110. User can then access his mails and download them to the local computer.
POP3 works in two modes. The most common mode the delete mode, is to delete the emails
from remote server after they are downloaded to local machines. The second mode, the keep
mode, does not delete the email from mail server and gives the user an option to access mails
later on mail server.

Hyper Text Transfer Protocol (HTTP)

The Hyper Text Transfer Protocol (HTTP) is the foundation of World Wide Web. Hypertext
is well organized documentation system which uses hyperlinks to link the pages in the text
documents. HTTP works on client server model. When a user wants to access any HTTP
page on the internet, the client machine at user end initiates a TCP connection to server on
port 80. When the server accepts the client request, the client is authorized to access web
pages.

To access the web pages, a client normally uses web browsers, who are responsible for
initiating, maintaining, and closing TCP connections. HTTP is a stateless protocol, which
means the Server maintains no information about earlier requests by clients.
HTTP versions

• HTTP 1.0 uses non persistent HTTP. At most one object can be sent over a single TCP
connection.
• HTTP 1.1 uses persistent HTTP. In this version, multiple objects can be sent over a
single TCP connection.

Dynamic Host Configuration Protocol (DHCP)

Dynamic Host Configuration Protocol (DHCP) is a client/server protocol that


automatically provides an Internet Protocol (IP) host with its IP address and other related
configuration information such as the subnet mask and default gateway. In DHCP, port
number 67 is used for the server and 68 is used for the client.

DHCP allows a network administrator to supervise and distribute IP addresses from a


central point and automatically sends a new Internet Protocol (IP) address when a
computer is plugged into a different place in the network.

DHCP is an application layer protocol that provides −

• Subnet Mask
• Router Address
• IP Address

DHCP Client-Server Communication Diagram

In DHCP, the client and the server exchange DHCP messages to establish a connection.
DHCP Discover Message − Client Requests DHCP Information
• It is the first message produced by a client in the communication process between the client and server
with the target address [Link] and the source address [Link].
• This message is produced by the client host to discover if there are any DHCP servers present in a
network or not.
• The message might contain other requests like subnet mask, domain name server, and domain name,
etc.
• The message is broadcast to all the devices in a network to find the DHCP server.

Common questions

Powered by AI

UDP is preferred over TCP in real-time applications like video streaming and online gaming because it is faster due to not having additional overhead like establishing a connection or ensuring reliable data delivery. UDP allows data to be sent without waiting for acknowledgements, reducing latency and conserving bandwidth as it avoids resending lost packets, which is acceptable in applications where some packet loss is not critical .

UDP could be considered a 'null protocol' when the checksum field is removed because the checksum is its primary error-checking feature. Without it, UDP lacks any errors detection mechanism, leaving all responsibility for packet handling and integrity to applications or other networking layers. It impacts UDP's operation by emphasizing speed and simplicity but at the expense of even minimal error correction capabilities .

UDP achieves process-to-process communication by using port numbers to differentiate user requests and processes. Each application uses a unique port number to send and receive messages, enabling direct communication between processes running on different hosts, despite the protocol's unreliability and lack of connection establishment .

UDP's stateless nature implies that it does not maintain a session state between sender and receiver, which facilitates continuous, unidirectional packet flow without connection re-establishment. For streaming applications, this leads to reduced latency and enhanced performance as packet headers are smaller and less complex. However, it sacrifices reliability due to not tracking or acknowledging packet delivery, which can result in data losses, sometimes tolerable in this context .

The checksum field in a UDP header is a 16-bit value used to protect data integrity across the network. It involves calculating a one's complement of the sum of the header, pseudo-header, and data, with zero padding if necessary. Although the field is optional in IPv4, it plays a role in ensuring that data is not corrupted during transit, contributing to better reliability within UDP’s constraints .

UDP and TCP differ fundamentally in ensuring reliable data transfer. TCP includes error checking, flow control, and acknowledges packet receipt, which ensures data arrives accurately and in sequence by retransmitting lost packets. This inherently introduces overhead and latency but secures reliability. UDP, conversely, lacks error checking and flow control, which reduces overhead and latency, facilitating faster data transmission, albeit without guarantees of delivery accuracy or order .

UDP's simplicity, attributed to its lack of connection establishment, error recovery, and flow control mechanisms, reduces processing overhead and latency. This simplicity allows for faster data transfers and more efficient bandwidth usage, giving UDP performance advantages in real-time applications where speed and low latency are prioritized over reliability .

TCP is more advantageous in scenarios requiring reliable data delivery, such as file transfers (FTP), emails (SMTP), and browsing (HTTP), where accuracy and completeness of data are critical. TCP’s features like error checking, retransmission of lost packets, and congestion control mechanisms ensure data integrity and flow management, suitable for applications where even slight data corruption or loss is unacceptable .

Real-time applications that typically use UDP include online gaming, video conferencing, and VoIP, due to its characteristics such as lower latency, smaller packet size, and no connection establishment overhead. These attributes help support applications where speed is critical and occasional packet losses do not considerably affect overall performance .

DNS uses UDP for querying and name resolution because DNS queries are small and typically require quick responses, which suits UDP’s characteristics. UDP allows a fast exchange of query and response messages without the overhead of establishing a connection, making it efficient for this purpose. DNS typically uses UDP on port 53, where it rapidly processes many brief transactions necessary for domain name resolutions .

You might also like