User Datagram Protocol (UDP)
LESSON 14
(October 20, 1995)
Daniel Z. Tabor Jr.
New Jersey Institute of Technology
Outline:
User Datagram Protocol (UDP)
Identifying Multiple Destinations within a Host:
- Software and communication protocols provide a
mechanism that distinguishes among multiple destinations
within a given host.
- Often, this mechanism is used to support transport
services for multiple applications.
- The ultimate destination in a host is not a process,
but a software Port.
- Software Ports:
- A set of abstract destinations points called protocol ports
are identified by positive integer values and controlled by
the local operating system.
- Ports are usually allocated by an operating system to an
application in the form of memory blocks, accessed by
specific data structures..
- Packets arriving from the IP layer, destined for a
particular port, are enqueued within a buffer.
- Protocol ports also use outgoing queues to store
messages being sent from an application program.
- To send and receive, we need to know the source and
destination port numbers. Both are always sent in each
message.
User Datagram Protocol (UDP):
- User Datagram Protocol (UDP):
- A connectionless, unreliable delivery service using the
IP protocol for its message transport.
- UDP distinguishes among multiple destinations in a
host, but sends no acknowledgments (ACKs).
- Applications using UDP must handle all problems to
ensure reliable transfer. They must deal with:
- Duplicate messages.
- Lost messages.
- Delayed and Out-of-Order delivery.
- UDP is good for delay-sensitive traffic such as video
and voice since no acknowledgment or retransmission features
are used.
UDP Message Format:
- UDP messages (called user datagrams) have two distinct
parts:
- UDP Headers
- UDP Data area
- The header is always a fixed size of 4 octets, which
specifies (in part) the source and destination protocol
ports.
- SOURCE PORT (16-bits):
- UDP protocol port number which specifies where replies
should be sent (optional = 0).
- DESTINATION PORT (16-bits):
- Required protocol port number to demultiplex datagrams
among waiting processes.
- MESSAGE LENGTH (16-bits):
- The count of octets in the UDP datagram, which includes the
header and data areas. Minimum length = 8 (length of only
the header).
- CHECKSUM (16-bits):
- The optional checksum is usually used since IP does not
compute any checksum on carried data. Set to zero if not
used.
UDP Pseudo-Header:
- UDP Pseudo-Header:
- Used to verify that the UDP datagram has reached it’s
correct destination (since UDP headers only use port
numbers).
- A checksum is computed over the pseudo-header, UDP-
header, and the data area before sending the user datagram.
- The twelve octets of the pseudo-header include the
fields:
- Source IP address (4-octets).
- Destination IP address (4-octets).
- Padding field filled with zeros (1-octet).
- Protocol Type (1-octet), (UDP = 17).
- UDP Length (2-octets)
- Length of the UDP datagram without the pseudo-header.
- These values are extracted from the IP datagram header,
then the checksum is recomputed (using this pseudo-header).
- ? Is there a problem with this scenario ?
Conceptual Layering:
| Application Layer |
| User Datagram Protocol (UDP) |
| Internet Protocol (IP) |
| Network Interface and Hardware |
UDP Encapsulation:
- UDP Encapsulation - [lowest layer to higher layers]
involves stripping off the headers at each appropriate
level.
- Outermost header- lowest layer protocol.
- Innermost header - highest protocol layer.
- Important distinction:
- IP Layer - transferring of data between a pair of hosts
on the Internet (only responsibility).
- UDP Layer - differentiating among multiple sources or
destinations within one host only (same for TCP as well).
UDP / IP Integration:
- UDP is tightly integrated with the IP protocol:
- This is practical.
- Produces greater efficiency.
- However, the tight integration violates our layering
abstraction and the independents of functionality that each
layer provides.
- ? How does it violate the layering abstraction?
- The UDP layer encapsulates UDP messages within an IP
datagram.
- It fills in the source and destination IP header
fields.
- It computes the UDP checksum.
- It then passes the IP datagram to the IP layer, which
fills in the rest of the header fields.
Multiplexing, Demultiplexing, and Ports:
- Applications negotiate with the operating system to
obtain a protocol port and the port number.
- UDP multiplexes application output from the various
protocol ports.
- It also demultiplexes input from the network
connection, to the appropriate receiving ports.
- Receiving packets to send to a port are:
- Normally placed in the active port's queue.
- Dropped if the port's queue is full.
- If the destination port is currently not in use, an
ICMP port unreachable error message is sent and the packet
is dropped.
UDP Input and Output:
- UDP does not have complex input and output modules
since it is connectionless.
It does however have separate modules to handle the
processing required in each, as well as input and output
queues.
UDP Port Numbers:
- ? How do we assign protocol port numbers ?
- Two fundamental approaches:
- Dynamic Port Binding:
- Large integer values are used to dynamically assign a
protocol port number (network software performs the
assignment).
- Universal Assignment:
- Everyone agrees on allowing a central authority to assign
and publish port numbers (software is built around
well-known port assignments).
- TCP/IP takes a hybrid approach to port assignment where
it:
- Assigns lower-valued port numbers to priori
applications
- Allows the higher-valued port numbersto be used by
local sites or application programs.
- ? How do we know which port to use when requesting an
application service?
- Send a port-service request message to the destination.
- It responds by providing the appropriate protocol port
in which to send packets to.
TCP/IP Protocol Tracing: ARP
- Checking the ARP Cache on homer.njit.edu using:
| Device | IP Address | Mask | Physical Address |
| be0 | vienna | 255.255.255.255 | 08:00:20:00:2b:97 |
| be0 | empire | 255.255.255.255 | 08:00:20:73:09:64 |
| be0 | picard | 255.255.255.255 | 08:00:20:72:a5:e6 |
| be0 | ocean | 255.255.255.255 | 08:00:20:73:35:c7 |
| le0 | earth-gw | 255.255.255.255 | 08:00:20:00:f5:4b |
| be0 | rtlab11 | 255.255.255.255 | 08:00:20:71:2a:a5 |
| le0 | itc_cis-gw | 255.255.255.255 | 00:00:81:11:2e:19 |
| be0 | homer | 255.255.255.255 | 08:00:20:71:3a:43 |
| le0 | inis-gw | 255.255.255.255 | aa:00:04:00:45:04 |
| le0 | newark-gw | 255.255.255.255 | 08:00:20:01:6f:3b |
| le0 | BASE-ADDRESS.MCAST.NET | 240.0.0.0 | 01:00:5e:00:00:00 |
| be0 | BASE-ADDRESS.MCAST.NET | 240.0.0.0 | 01:00:5e:00:00:00 |
TCP/IP Protocol Tracing: IP
- Connecting to CIS456-HTML from Daniel Tabor's home-page
on hertz.njit.edu:
- Domain Name to IP Address Resolution:
| 0 | IP 127.0.0.1 | ->128.235.251.10 | len 69 | prot 17 |
| 1 | IP 128.235.251.10 | ->127.0.0.1 | len 131 | prot 17 |
| 0 | IP 127.0.0.1 | ->128.235.251.10 | len 60 | prot 17 |
| 1 | IP 128.235.251.10 | ->127.0.0.1 | len 281 | prot 17 |
- Document Transfer from CIS456-HTML:
| 0 | IP 127.0.0.1 | ->128.235.35.70 | len 44 | prot 6 |
| 1 | IP 128.235.35.70 | ->127.0.0.1 | len 40 | prot 6 |
| 0 | IP 127.0.0.1 | ->128.235.35.70 | len 40 | prot 6 |
| 0 | IP 127.0.0.1 | ->128.235.35.70 | len 321 | prot 6 |
| 1 | IP 128.235.35.70 | ->127.0.0.1 | len 40 | prot 6 |
| 1 | IP 128.235.35.70 | ->127.0.0.1 | len 122 | prot 6 |
| 0 | IP 127.0.0.1 | ->128.235.35.70 | len 40 | prot 6 |
| 1 | IP 128.235.35.70 | ->127.0.0.1 | len 40 | prot 6 |
| 0 | IP 127.0.0.1 | ->128.235.35.70 | len 40 | prot 6 |
- Copyright/Audit Image Loading and Resolution:
| 0 | IP 127.0.0.1 | ->204.217.174.42 | len 44 | prot 6 |
| 1 | IP 204.217.174.42 | ->127.0.0.1 | len 40 | prot 6 |
| 0 | IP 127.0.0.1 | ->204.217.174.42 | len 40 | prot 6 |
| 0 | IP 127.0.0.1 | ->204.217.174.42 | len 319 | prot 6 |
| 1 | IP 204.217.174.42 | ->127.0.0.1 | len 40 | prot 6 |
| 1 | IP 204.217.174.42 | ->127.0.0.1 | len 315 | prot 6 |
| 0 | IP 127.0.0.1 | ->204.217.174.42 | len 40 | prot 6 |
| 1 | IP 204.217.174.42 | ->127.0.0.1 | len 40 | prot 6 |
| 0 | IP 127.0.0.1 | ->204.217.174.42 | len 40 | prot 6 |
TCP/IP Protocol Tracing: DNS
Last Modification: (Sunday, August 25, 1996)
All work was written, produced, and is copyrighted by Daniel Z. Tabor Jr.
Page created by Daniel Z. Tabor Jr.
Copyright ©1996 Illusion Industries Inc.
