UDP Services

 

UDP Services

UDP provides a simple, connectionless transport service with very little overhead. The services provided by UDP can be understood in terms of the general services expected from a transport-layer protocol.

1. Process-to-Process Communication

UDP provides process-to-process communication using a socket address.

A socket address is the combination of:

  • IP address → identifies the host
  • Port number → identifies the process/application on that host

Thus, UDP delivers a datagram to the correct application process using the destination IP address and destination port number.


2. Connectionless Service

UDP provides a connectionless service.

This means:

  • Each user datagram is treated as an independent unit.
  • There is no relationship between different datagrams, even if they come from the same source and go to the same destination.
  • User datagrams are not numbered.
  • There is no connection establishment before transmission.
  • There is no connection termination after transmission.
  • Different datagrams may travel through different paths.

For example, if three datagrams are sent:

Datagram 1 ───────→
Datagram 2 ───────→
Datagram 3 ───────→

they are independent of one another.

Important consequence

An application cannot give UDP a long continuous stream of data and expect UDP to divide it into related datagrams.

Each message must be small enough to fit into a single UDP user datagram.

According to the textbook, the maximum application data that can fit in a UDP datagram is:

where:

  • 65,535 bytes = maximum IP datagram size
  • 8 bytes = UDP header
  • 20 bytes = minimum IP header

3. Flow Control

UDP does not provide flow control.

There is:

  • no flow-control mechanism,
  • no sliding-window mechanism.

Therefore, a receiver can potentially be overwhelmed if UDP datagrams arrive faster than the receiving process can handle them.

If flow control is required, the application using UDP must provide it.


4. Error Control

UDP has no error-control mechanism except the checksum.

Therefore, UDP does not provide:

  • retransmission of lost datagrams,
  • acknowledgment of received datagrams,
  • detection of duplicate datagrams,
  • recovery of out-of-order datagrams.

If a datagram is corrupted, the checksum can detect the error and the datagram is silently discarded.

The sender is not informed whether a datagram was:

  • lost,
  • duplicated, or
  • discarded because of corruption.

If an application requires these error-control functions, they must be implemented by the application process.


5. UDP Checksum

The UDP checksum provides error detection.

The checksum calculation includes three parts:

  1. Pseudoheader
  2. UDP header
  3. Data
       UDP Checksum Calculation

       +------------------+
       |   Pseudoheader   |
       +------------------+
       |    UDP Header    |
       +------------------+
       |      Data        |
       +------------------+



Pseudoheader

The pseudoheader contains selected information from the IP header:

  • Source IP address
  • Destination IP address
  • Protocol field
  • UDP total length
  • Some zero-filled fields

The protocol field for UDP is 17.

Why is the pseudoheader used?

Suppose the IP header is corrupted during transmission and the datagram is delivered to the wrong host. Without the pseudoheader, the UDP checksum might not detect this particular problem.

Including the source and destination IP addresses in the checksum calculation helps detect such errors.

The protocol field also ensures that the datagram belongs to UDP, rather than TCP.


6. Optional Inclusion of Checksum

Accordingly, the sender can choose not to calculate the UDP checksum.

Case 1: Checksum is not calculated

The checksum field is filled with:

0000000000000000

That is, all bits are 0.

This indicates that the checksum has not been calculated.

Case 2: Checksum is calculated

If the calculated result is all 1s, the value sent is all 0s after complementation, which could be confused with the previous case.

Therefore, the sender complements the result again so that the transmitted checksum becomes:

1111111111111111

This avoids ambiguity.


7. Congestion Control

UDP does not provide congestion control.

The original assumption was that UDP datagrams are:

  • small, and
  • sent sporadically,

so they would not create significant congestion.

However, the textbook points out that this assumption may not always be true, particularly because UDP is used for interactive real-time transmission of audio and video.

Therefore, UDP itself does not regulate the rate at which datagrams are injected into the network.


8. Encapsulation and Decapsulation

UDP performs encapsulation and decapsulation.

At the sender

The application gives data to UDP.

UDP adds its 8-byte header to the data.

Application Data
       ↓
+----------------+
|   UDP Header   |
+----------------+
|      Data      |
+----------------+
       ↓
   UDP Datagram

The resulting UDP datagram is then passed to IP.

At the receiver

IP delivers the UDP datagram to UDP.

UDP:

  1. examines the UDP header,
  2. removes the header,
  3. extracts the application data,
  4. delivers the data to the appropriate process.

9. Queuing

UDP associates queues with port numbers.

When a process starts, it requests a port number from the operating system.

Depending on the implementation, the system may create:

  • an incoming queue and outgoing queue, or
  • only an incoming queue.

The incoming queue holds UDP datagrams that have arrived for a particular process until the process is ready to receive them.

A simplified representation is:

                 UDP
                  |
        +---------+---------+
        |                   |
   Port 5000             Port 6000
   Incoming Queue        Incoming Queue
        |                   |
    Process A            Process B

Thus, queues help UDP temporarily hold datagrams associated with different application processes.


10. Multiplexing and Demultiplexing

A host normally has one UDP implementation, but many application processes may simultaneously use UDP.

UDP therefore performs:

Multiplexing

At the sender, UDP accepts data from multiple application processes and sends their datagrams through the network.

Process A ──┐
Process B ──┼──→ UDP ──→ IP
Process C ──┘

Demultiplexing

At the receiver, UDP receives datagrams from the network and delivers each datagram to the correct application process, using the destination port number.

                 UDP
                  |
        +---------+---------+
        ↓         ↓         ↓
    Process A  Process B  Process C

UDP Services at a Glance

ServiceUDP Support
Process-to-process communication            Yes
Connectionless serviceYes
Flow controlNo
Error controlOnly checksum/error detection
RetransmissionNo
SequencingNo
Congestion controlNo
Encapsulation/DecapsulationYes
QueuingYes
Multiplexing/DemultiplexingYes

Key Point

The textbook summarizes UDP as a very simple connectionless protocol. Compared with the generic simple connectionless protocol discussed earlier, the important additional feature provided by UDP is the optional checksum for detecting corrupted datagrams.

Comments

Popular posts from this blog

Computer Networks PCCST501 Semester 5 KTU CS 2024 Scheme - Dr Binu V P

Introduction to Computer Networks

Introduction to Local Area Network (LAN)