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

Unit 6 NT (ii) UDP

The document discusses the User Datagram Protocol (UDP), highlighting its characteristics such as connectionless communication, message-oriented interface, and best-effort delivery semantics. It explains how UDP facilitates end-to-end communication, allowing applications to send messages without establishing a connection, and details the structure of UDP datagrams, including header and payload. Additionally, it covers the importance of message size, the role of port numbers, and the optional checksum for error checking.

Uploaded by

zegangaming123
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)
2 views

Unit 6 NT (ii) UDP

The document discusses the User Datagram Protocol (UDP), highlighting its characteristics such as connectionless communication, message-oriented interface, and best-effort delivery semantics. It explains how UDP facilitates end-to-end communication, allowing applications to send messages without establishing a connection, and details the structure of UDP datagrams, including header and payload. Additionally, it covers the importance of message size, the role of port numbers, and the optional checksum for error checking.

Uploaded by

zegangaming123
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
You are on page 1/ 22

Message Transport With

The User Datagram Protocol


User Datagram Protocol (UDP)

d Used
– During startup
– For VoIP and some video applications
d Accounts for less than 10% of Internet traffic
d Blocked by some ISPs

Computer Networks and Internets -- Module 5 132 Spring, 2014

Copyright  2014. All rights reserved.


UDP Characteristics

d End-to-end
d Connectionless communication
d Message-oriented interface
d Best-effort semantics
d Arbitrary interaction
d Operating system independence
d No congestion or flow control

Computer Networks and Internets -- Module 5 133 Spring, 2014

Copyright  2014. All rights reserved.


End-To-End Communication

d UDP provides communication among applications


d Sending UDP
– Accepts outgoing message from application
– Places message in a User Datagram
– Encapsulates User Datagram in an IP datagram and
sends
d Receiving UDP
– Accepts incoming User Datagram from IP
– Extracts message and delivers to receiving application
d Note: message is unchanged by the network

Computer Networks and Internets -- Module 5 134 Spring, 2014

Copyright  2014. All rights reserved.


Connectionless Communication

d An application using UDP can


– Send a message to any receiver (universal)
– Send at any time (asynchronous)
– Stop sending at any time (unterminated)
d That is, a sender does not
– Inform the network before sending (i.e., does not
establish a communication channel)
– Inform the other endpoint before sending
– Inform the network or other endpoint that no more
messages will be sent

Computer Networks and Internets -- Module 5 135 Spring, 2014

Copyright  2014. All rights reserved.


Message-Oriented Interface

d UDP
– Accepts and delivers messages (blocks of data)
– Does not require all messages to be the same size, but
does define a maximum message size
– Places each outgoing User Datagram in a single IP
datagram for transmission
– Always delivers a complete message to receiving
application
d Sending application must divide outgoing data into
messages; UDP sends what it is given (or reports an error if
the message is too large)

Computer Networks and Internets -- Module 5 136 Spring, 2014

Copyright  2014. All rights reserved.


UDP Message Size

d UDP allows up to 64K octet messages


d As a practical limit, the size of a User Datagram is limited
by payload area in IP datagram
d Maximum IP payload is 64K octets minus size of IP header
d Therefore, the maximum UDP payload is 64K octets minus
size of IP and UDP headers (usually 64K octets minus 28)
d Application can choose any message size up to the
maximum UDP payload

Computer Networks and Internets -- Module 5 137 Spring, 2014

Copyright  2014. All rights reserved.


Large And Small Messages

d What happens if an application sends a 10K octet message?


d The message fits into an IP datagram, but... network frames
have a smaller MTU (typically 1500 octets)
d So, the result of sending a large message is

IP Fragmentation!

d What happens if an application chooses a small message


size, such as 20 octets?

Inefficiency!

Computer Networks and Internets -- Module 5 138 Spring, 2014

Copyright  2014. All rights reserved.


Choosing An Optimal Message Size

d What size messages should an application send?


d Optimal UDP message size is S = M – H
– M is the path MTU (i.e., minimum MTU on the path)
– H is the size of IP and UDP headers
d Finding M requires an application to
– Violate layering and obtain forwarding information from
IP
– Note: for IPv4, only the local MTU is known
d Bottom line: it may be difficult/ impossible for an
application to compute S

Computer Networks and Internets -- Module 5 139 Spring, 2014

Copyright  2014. All rights reserved.


UDP Semantics

d UDP uses IP for delivery and offers the same semantics!


d UDP packet can be
– Lost
– Duplicated
– Delayed
– Delivered out of order
– Delivered with data bits altered
d Note 1: UDP does not introduce such errors; the errors arise
from the underlying networks
d Note 2: UDP does include an optional checksum to protect
the data (but the checksum may be disabled)

Computer Networks and Internets -- Module 5 140 Spring, 2014

Copyright  2014. All rights reserved.


Using Best-Effort Semantics

d Questions
– Do best-effort semantics make any sense for
applications?
– Why would a programmer choose UDP?
d Answers
– Retransmitting a lost message does not make sense for
real-time audio and video applications because a
retransmitted packet arrives too late to be used
– Additional real-time protocols can be added to UDP to
handle out-of-order delivery (we will cover later in the
course)

Computer Networks and Internets -- Module 5 141 Spring, 2014

Copyright  2014. All rights reserved.


Arbitrary Interaction

d UDP permits arbitrary interaction among applications


1-to-1
1-to-many
Many-to-1
Many-to-many

d Application programmer chooses interaction type


d Ability to send a single message to multiple recipients can
be valuable

Computer Networks and Internets -- Module 5 142 Spring, 2014

Copyright  2014. All rights reserved.


Efficient Implementation Of Interaction

d Key point: UDP can use IP broadcast or multicast to deliver


messages
d Provides efficient delivery to a set of hosts
d Example: UDP packet sent to IPv4 destination address
255.255.255.255 is delivered to all hosts on the local
network (IPv6 has an all nodes multicast address)
d No need for sender to transmit individual copies
d Allows application to find a server without knowing the
computer on which the server runs
d Broadcast is a significant advantage of UDP over TCP for
some applications

Computer Networks and Internets -- Module 5 143 Spring, 2014

Copyright  2014. All rights reserved.


Operating System Independence

d Goal is to allow applications on heterogeneous computers to


interact
d Must avoid OS-specific identifiers, such as
– Process IDs
– Task names
d Instead, create application identifiers that are not derived
from any OS

Computer Networks and Internets -- Module 5 144 Spring, 2014

Copyright  2014. All rights reserved.


UDP Application Identifiers

d 16-bit integer known as UDP protocol port number


d Each application using UDP must obtain a port number
d Sending UDP
– Places a port number in UDP header to identify
destination application on receiving host
– Also includes port number of sending application
d Receiving UDP
– Uses value in header to select appropriate application

UDP protocol port numbers are universal across all computers,


and do not depend on the operating system.

Computer Networks and Internets -- Module 5 145 Spring, 2014

Copyright  2014. All rights reserved.


Identifying An Application

d Both sending and receiving applications need a port number


d Assignment of port numbers depends on the type of
application
d Application that offers a standardized service (server)
– Uses a well-known port number for the service
– Value is less than 1024
– Example: TFTP service uses UDP port 69
d Other applications (client)
– Request a port number from the local operating system
– Value is greater than 49151

Computer Networks and Internets -- Module 5 146 Spring, 2014

Copyright  2014. All rights reserved.


Steps Taken To Contact A Service

d Request an unused local port number from the local


operating system
d Obtain the IP address of the local computer from the
operating system
d Look up the port number of the service to be contacted
d Obtain the domain name of a computer that runs the service
and map to an IP address
d Form a UDP datagram with a source port field set to the
local port number and the destination port field set to the
port number of the service
d Request that the UDP datagram be encapsulated in an IP
datagram and sent using the source and destination IP
addresses obtained above
Computer Networks and Internets -- Module 5 147 Spring, 2014

Copyright  2014. All rights reserved.


Examples Of Well-Known UDP Ports
222222222222222222222222222222222222222222222222222222
1 Port Number 1 Description 1
222222222222222222222222222222222222222222222222222222
1 1 1
1 0 1 Reserved (never assigned) 1
1 7 1 Echo 1
1 9 1 Discard 1
1 1 1
1 11 1 Active Users 1
1 13 1 Daytime 1
1 15 1 Network Status Program 1
1 17 1 Quote of the Day 1
1 1 1
1 19 1 Character Generator 1
1 37 1 Time 1
1 42 1 Host Name Server 1
1 43 1 Who Is 1
1 1 1
1 53 1 Domain Name Server 1
1 67 1 BOOTP or DHCP Server 1
1 68 1 BOOTP or DHCP Client 1
1 1 1
1 69 1 Trivial File Transfer 1
1 88 1 Kerberos Security Service 1
1 111 1 Sun Remote Procedure Call 1
1 123 1 Network Time Protocol 1
1 1 1
1 161 1 Simple Network Management Protocol 1
1 162 1 SNMP Traps 1
1 514 1 System Log 1
1222222222222222222222222222222222222222222222222222222 1 1

Computer Networks and Internets -- Module 5 148 Spring, 2014

Copyright  2014. All rights reserved.


UDP Datagram Format

d Extremely thin layer


d User Datagram is divided into header and payload
d Header contains only 8 octets:
0 16 31

UDP SOURCE PORT UDP DESTINATION PORT

UDP MESSAGE LENGTH UDP CHECKSUM

PAYLOAD (MESSAGE DATA)

...

d Question: why is length needed?

Computer Networks and Internets -- Module 5 149 Spring, 2014

Copyright  2014. All rights reserved.


UDP Checksum

d 16-bit 1s-complement checksum


d Covers entire UDP packet, including data (recall: IP does
not checksum the payload)
d Is optional: value of zero means sender did not compute a
checksum
d Includes extra pseudo header that contains IP addresses
d Example of IPv4 pseudo header:
0 16 31

IP SOURCE ADDRESS

IP DESTINATION ADDRESS

ZERO PROTO UDP LENGTH

Computer Networks and Internets -- Module 5 150 Spring, 2014

Copyright  2014. All rights reserved.


Purpose Of A Pseudo Header

d Receiver can verify that message arrived at correct computer


as well as correct application on that computer
d Consequence for NAT: if it changes the IP source or
destination address, NAT must recompute UDP checksum
d Note: pseudo headers provide another example of layering
violations

Computer Networks and Internets -- Module 5 151 Spring, 2014

Copyright  2014. All rights reserved.


UDP Encapsulation

d User Datagram travels in IP datagram


d Two levels of encapsulation occur

UDP Hdr UDP Payload

IP Header IP Payload

Frame Header Frame Payload

d Note: the message the application places in the UDP


Payload field may also have header and payload fields

Computer Networks and Internets -- Module 5 152 Spring, 2014

Copyright  2014. All rights reserved.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy