0% found this document useful (0 votes)
6 views

ITT420 - Chapter 6 UDP

Uploaded by

nurul najwa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

ITT420 - Chapter 6 UDP

Uploaded by

nurul najwa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 42

Chapter 6 – User Datagram Protocol (UDP)

ITT420
Network & System Administration

Adapted from : TCP/IP Protocol Suite 3 rd Edition by Behrouz A. Forouzan


Summarized by: Nor Adora Endut, FSKM, UiTM
Chapter Outline
 Process-to-process Communication
 UDP Features
 UDP Header Fields
Position of UDP in TCP/IP Protocol Suite
Process-to-Process Communication
 The transport layer is responsible for process-to-process
delivery—the delivery of a packet, part of a message, from one
process to another.
 Two processes communicate in a client/server relationship
Types of Data Delivery
Process-to-Process Communication
 The most common way to achieve process-to-process
communication is through the client/server paradigm 
client (local) request services from server (remote)
 At the transport layer, port numbers are used for
addressing
Port Numbers
 The client process defines itself with a port number, called
the ephemeral port number
 The server process must also define itself with a port
number, called the well-known port numbers
Port Numbers
Port No vs IP Address
Port Numbers
 ICANN has divided the port numbers into three ranges
 Well known – ports ranging from 0 to 1023
 Registered – ports ranging from 1024 to 49 151, not assigned or
controlled by ICANN but can be registered to prevent
duplication
 Dynamic – ports ranging from 49152 to 65 535
Port Numbers
Socket Address
 To use the services of UDP, we need a pair of socket
addresses – the client socket address and the server socket
address
Multiplexing and Demultiplexing
 Multiplexing
 At the sender site, there is a many-to-one relationship between
the process and the transport layer
 The protocol accepts messages from different processes,
differentiated by their assigned port numbers
 After adding the header, the transport layer passes the packet to
the network layer
 Demultiplexing
 At the receiver site, the relationship is one-to-many
 The transport layer receives datagrams from the network layer
 After checking and dropping of the header, the transport layer
delivers each message to the appropriate process based on the
port number
Multiplexing and Demultiplexing
Reliability
 The transport layer can be either reliable or unreliable
 If the application layer program needs reliability, is uses a
reliable transport layer protocol by implementing flow and
error control which means a slower and more complex
service
 If it does not need reliability, then an unreliable transport
layer protocol can be used
Reliability
User Datagram
 UDP packets are called user datagrams
User Datagram
 The fields of the datagram are
 Source port number – 16 bits
 Destination port number – 16 bits
 Length – 16 bits, defines the total length of the user datagram
(header plus data)
UDP length = IP length – IP header’s length
 Checksum – used to detect errors over the entire user datagram
Checksum
 Checksum consists of 3 sections
 Pseudoheader
 UDP header
 Data
 Pseudoheader – part of the header of the IP packet in
which the user datagram is to be encapsulated with some
fields filled with 0s
Checksum
Checksum
 The protocol field is added to ensure that the packet
belongs to UDP, and not to TCP
 Checksum calculation at sender
 Add the pseudoheader to the UDP user datagram
 Fill the checksum with zeros
 Divide the total bits into 16-bit words
 If the total number of bytes is not even, add 1 byte of padding
(all 0s). The padding is only for the purpose of calculating the
checksum
Checksum
 Checksum calculation at sender (cont)
 Add all 16-bit sections using one’s complement
 Complement the result and insert it in the checksum field
 Drop the pseudoheader and any added padding
 Deliver the UDP user datagram to the IP software for
encapsulation
Checksum
 Checksum calculation at receiver
 Add the pseudoheader to the UDP user datagram
 Add padding if needed
 Divide the total bits into 16-bit sections
 Add all 16-bit sections using one’s complement
 Complement the result
 If the result is all 0s, drop the pseudoheader and any added
padding and accept the user datagram. If the result is anything
else, discard the user datagram
Checksum
UDP Operation
 Connectionless Service
 Flow and Error Control
 Encapsulation and Decapsulation
 Queuing
 Multiplexing and Demultiplexing
UDP Operation
 Connectionless service
 Each user datagram sent by UDP is an independent datagram
 There is no connection establishment and termination – user
datagram can travel on a different path
 Only those processes sending short messages should use UDP
UDP Operation
 Flow and error control
 There is no flow control in UDP, hence the receiver may
overflow with incoming messages
 Error control is only in the form of the checksum – the sender
doesn’t know if a message has been lost or duplicated
 The process using UDP should provide for these mechanism
UDP Operation
 Encapsulation & Decapsulation
 To send a message from one process to another the UDP
protocol encapsulates and decapsulates messages
 Encapsulation
 When a process has a message to send through UDP, it passes the
message to UDP along with a pair of socket addresses and the length
of data
 UDP receives the data and adds the UDP header and passes the user
datagram to IP with the socket addresses
UDP Operation
 Encapsulation & Decapsulation (cont)
 Encapsulation
 IP adds its own header, using the value 17 in the protocol field,
indicating that the data has come from the UDP protocol
 The IP datagram is then passed to the data link layer
 The data link layer receives the IP datagram and adds its own header
and passes it to the physical layer
 The physical layer encodes the bits into electrical or optical signals
and sends it to the remote machine
UDP Operation
 Encapsulation & Decapsulation (cont)
 Decapsulation
 When the message arrives at the destination host, the physical layer
decodes the signals into bits and passes it to the data link layer
 The data link layer uses the header to check the data. If there is no
error, the header is dropped and the datagram is passed to IP
 The IP software does its own checking. If there is no error, the header
is dropped and the user datagram is passed to UDP with the sender
and receiver IP addresses
UDP Operation
 Encapsulation & Decapsulation (cont)
 Decapsulation
 UDP uses the checksum to check the entire user datagram. If there is
no error the header is dropped and the application data along with the
sender socket address is passed to the process
UDP Operation
 Encapsulation and Decapsulation
UDP Operation
 Queuing
 In UDP queues are associated with ports
 At the client site, when a process starts, it requests a port
number from the OS
 Some implementations create both an incoming and outgoing
queue associated with each process
 Other implementations create only an incoming queue
associated with each process
UDP Operation
 Queuing
 The queues opened by the client are identified by ephemeral
port numbers
 When the process terminates the queues are destroyed
 The client process can send messages to the outgoing queue by
using the source port number specified in the request
UDP Operation
 Queuing
 UDP removes the messages one by one, and after adding the
UDP header, delivers them to IP
 An outgoing queue can overflow. If this happens the OS can
ask the client process to wait before sending any more
messages
 When a message arrives for a client, UDP checks to see if an
incoming queue has been created for the port number specified
in the destination port number field of the user datagram
UDP Operation
 Queuing
 At the server, a server asks for incoming and outgoing queues
using its well-known port number field
 All of the incoming messages for one particular server, are sent
to the same queue
 When a server wants to respond to a client, it sends messages to
the outgoing queue using the source port number specified in
the request
UDP Operation
 Queues in UDP
UDP Operation
 Multiplexing & Demultiplexing
 In a host running a TCP/IP protocol suite, there is only one
UDP but possibly several processes that may want to use the
services of UDP. To handle this, UDP multiplexes and
demultiplexes
 Multiplexing
 UDP accepts the messages from different processes, differentiated by
their assigned port numbers
 After adding the header, UDP passes the user datagram to the IP
UDP Operation
 Multiplexing & Demultiplexing
 Demultiplexing
 At the receiver, UDP receives datagrams from IP
 After error checking and dropping of the header, UDP delivers each
message to the appropriate process based on the port number
UDP Operation
 Multiplexing & Demultiplexing
Use of UDP
 Process that requires simple request-response
communication with little concern for flow and error
control
 Process that has internal flow and error control
mechanisms
 Transport protocol for multicasting
 Network management processes
 Route updating protocols
Popular TCP/IP Applications using UDP

You might also like