Datagram Transport Service

Download Report

Transcript Datagram Transport Service

Department of Engineering Science
ES465/CES 440, Intro. to Networking & Network Management
UDP: Datagram Transport Service
http://www.sonoma.edu/users/k/kujoory
References
• “Computer Networks & Internet,” Douglas Comer, 6th ed, Pearson, 2014, Ch 24,
Textbook, 5th ed, slides by Lami Kaya ([email protected]) with some changes.
• “Computer Networks,” A. Tanenbaum, 5th ed., Prentice Hall, 2011, ISBN:
13:978013212695-3.
• “Computer & Communication Networks,” Nader F. Mir, 2nd ed, Prentice Hall, 2015, ISBN:
13: 9780133814743.
• “Data Communications Networking,” Behrouz A. Forouzan, 4th ed, Mc-Graw Hill, 2007
• “Data & Computer Communications,” W. Stallings, 7th ed., Prentice Hall, 2004.
• “Computer Networks: A Systems Approach," L. Peterson, B. Davie, 4th Ed., Morgan
Kaufmann 2007.
Ali Kujoory
5/31/2016
Not to be reproduced without permission
1
Topics Covered
•
•
•
•
•
•
•
•
•
•
•
24.1 Introduction
24.2 Transport Protocols & End-to-End Communication
24.3 The User Datagram Protocol
24.4 The Connectionless Paradigm
24.5 Message-Oriented Interface
24.6 UDP Communication Semantics
24.7 Modes of Interaction & Broadcast Delivery
24.8 Endpoint Identification with Protocol Port Numbers
24.9 UDP Datagram Format
24.10 The UDP Checksum & the Pseudo Header
24.11 UDP Encapsulation
Ali Kujoory
5/31/2016
Not to be reproduced without permission
2
24.1 Introduction
• This chapter
– considers UDP, one of the two major transport-layer protocols
used in the Internet & the only connectionless transport service
– discusses the UDP packet format & the ways UDP can be used
– covers the important concept of protocol port numbers
• The next chapter
– continues the discussion by focusing on the other major transportlayer protocol, TCP
• Later chapters
– discuss Internet routing & network management, which each use
transport protocols
Ali Kujoory
5/31/2016
Not to be reproduced without permission
3
24.2 Transport Protocols & End-to-End Communication
• IP cannot distinguish among multiple application
programs running on a given host
– If a user runs an email application & a web browser at the same
time or runs multiple copies of a given application
• they must be able to communicate independently
• From IP's point of view, the source & destination fields in
a datagram identify a host
– IP does not have bits to identify an application on the host
– We say that IP treats a computer as an endpoint of communication
• Transport-layer protocols are known as end-to-end
protocols
– a transport protocol allows an application to be an endpoint of
communication
• TCP/IP placed end-to-end protocols in Layer 4
Ali Kujoory
5/31/2016
Not to be reproduced without permission
4
24.3 The User Datagram Protocol
• TCP/IP suite contains two transport protocols
– User Datagram Protocol (UDP, RFC 768)
– Transmission Control Protocol (TCP, RFC 793, 1122, 1323)
•
•
•
•
They differ in the service they offer to applications
UDP is less complex & easy to understand
UDP can be characterized as:
End-to-end
– UDP can distinguish among multiple applications running on a
given computer
• Connectionless
• Message-oriented
– UDP sends & receives individual messages
Ali Kujoory
5/31/2016
Not to be reproduced without permission
5
Overview of OSI & TCP/IP Protocol Suites
OSI Stack
Application
Presentation
Session
Transport
Network
TCP/IP Stack
File
Transfer
Protocol
(FTP)
RFC 959
Simple Mail TELNET
Hypertext
Transfer
(Terminal
Transfer
Protocol Emulation)
Protocol
(SMTP)
RFC 854,
(HTTP)
RFC 821861
RFC 2616
822
..
Transmission Control Protocol (TCP)
RFC 793, 1122, 1323
Address Resolution
ARP RFC 826
RARP RFC 903
Simple
Domain
Network
Name
Video
Management
Syatem
and
Protocol
(DNS)
Voice
(SNMP)
RFC 1034- over IP
RFC 14411035
1452
User Datagram Protocol
(UDP), RFC 768
Internet Protocol (IP)
RFC 791
Internet Control Message
Protocol (ICMP) RFC 792
Data Link
Network Interface Cards:
Ethernet, Token Ring, RFC 894, RFC 1042, RFC 1231
Physical
Transmission Media:
Twisted Pair, Coax, or Fiber Optics
Notes:
 Other applications: Security, ..
 Trivial FTP (TFTP, RFC 783) runs over UDP
 Original RFCs are shown. For updated RFCs go to http://www.ietf.org
Ali Kujoory
5/31/2016
Not to be reproduced without permission
6
24.3 The User Datagram Protocol
• Best-effort Delivery
– It offers applications the same best-effort delivery semantics as IP
• Arbitrary Interaction
– UDP allows an application
• to send to many other applications
• receive from many other applications, or
• communicate with exactly one other application
• Operating System Independent
– UDP provides a means of identifying application programs
– It does not depend on identifiers used by the local OS
• UDP is sometimes characterized as a thin protocol
layer
Ali Kujoory
5/31/2016
Not to be reproduced without permission
7
24.4 The Connectionless Paradigm
• UDP uses a connectionless communication paradigm
– means that an application using UDP does not need to preestablish communication (connection) before sending data
– an application can generate & send data at any time
– UDP allows an application to delay an arbitrarily long time
between the transmission of two messages
• UDP does not maintain state
• UDP does not use control messages
– communication consists only of the data messages themselves
• UDP has extremely low overhead
• UDP can serve different ports.
– Multiplexing
port 1
port 2
port 3
UDP
Ali Kujoory
5/31/2016
Not to be reproduced without permission
8
24.5 Message-Oriented Interface
• UDP offers applications a message-oriented interface
• Each time an application requests that UDP send data
– UDP places the data in a single message for transmission
– UDP does not divide a message into multiple packets
– UDP does not combine messages for delivery
• Message-oriented interface has several consequences:
– On the positive side
• applications preserve data boundaries
⌐ each message will be exactly the same as was transmitted
– On the negative side
• each UDP message must fit into a single IP datagram
Ali Kujoory
5/31/2016
Not to be reproduced without permission
9
24.5 Message-Oriented Interface
• IP datagram size forms an absolute limit on the size
• UDP message size can lead to inefficient use of the
network
• If an application sends extremely small messages
– datagrams will have a large ratio of header octets to data octets
• If an application sends extremely large messages
– datagrams may be larger than the network MTU
– datagrams will be fragmented by IP
• An application programmer can achieve higher
efficiency by using large transfers
– With UDP, however, sending large messages leads to less
efficiency
• because large messages cause fragmentation
Ali Kujoory
5/31/2016
Not to be reproduced without permission
10
24.6 UDP Communication Semantics
• UDP uses IP for all delivery
• UDP provides best-effort delivery semantics as IP
• This means messages can be:
–
–
–
–
–
Lost
Duplicated
Delayed
Delivered out-of-order
Corrupted
• UDP's best-effort delivery semantics have important
consequences for applications
– An application must either be immune to the problems or the
programmer must take additional steps to detect & correct
problems
Ali Kujoory
5/31/2016
Not to be reproduced without permission
11
24.6 UDP Communication Semantics
• As an example of an application that can tolerate packet
errors, consider an audio transmission
– If the sender places a small amount of audio in each message
• the loss of a single packet produces a small gap in the playback
• This gap will be heard as a pop or click
• This undesirable noise can be annoying in some cases
• At the opposite extreme, consider an on-line shopping
application
– Such applications do not use UDP
• because packet errors can have serious consequences
(e.g., duplication of a message that carries a catalog order can result in
two orders, with double charges being made to the buyer's credit card)
Ali Kujoory
5/31/2016
Not to be reproduced without permission
12
24.7 Modes of Interaction & Broadcast Delivery
• UDP allows four styles of interaction:
–
–
–
–
1-to-1
1-to-many
Many-to-1
Many-to-many
• An application using UDP has a choice
• A 1-to-many interaction can be achieved as follows
– An application to repeatedly send a message to multiple recipients
– An application to transmit the message via IP multicast or
broadcast, e.g.,
• local broadcast can be specified by using IP's limited broadcast
address, 255.255.255.255
Ali Kujoory
5/31/2016
Not to be reproduced without permission
13
24.8 Endpoint Identification with Protocol Port Numbers
• How should UDP identify an application as an endpoint?
– UDP could use the same mechanism that the OS uses
– Because UDP must span heterogeneous computers
• no common mechanism exists
• E.g.,
– some OS use process identifiers
– others use job names, &
– others use task identifiers
• To avoid ambiguity
– UDP defines an abstract set of identifiers called protocol port #s that are
independent of the OS
– UDP must provide a mapping between protocol port #s & the program
identifiers that the OS uses
• All computers running UDP recognize the standard protocol port
#s, independent of the OS
Ali Kujoory
5/31/2016
Not to be reproduced without permission
14
24.9 UDP Datagram Format
• Each UDP message is called a
User Datagram & consists of
two parts:
– a short header (8 bytes) that
specifies the sending & receiving
application
– a payload that carries the data
being sent
• Fig. 24.1 illustrates the user
datagram format
• UDP Source & destination ports
- Client use a temporary port #,
server uses well-known port #
• Lengths is total length of
header & data (min 8 B, max
65515 B)
• Checksum is used for error
checking of header & data
Figure 24.1 The format of a UDP user datagram with an 8-octet header
Ali Kujoory
5/31/2016
Not to be reproduced without permission
15
24.10 The UDP Checksum & the Pseudo Header
• UDP header contains a
16-bit field named UDP
checksum (optional)
• UDP uses a onescomplement checksum
– A sender can either choose
to compute a checksum or
– set all bits of the checksum
field to zero (i.e., not used)
• When a message arrives
at the destination
– UDP software examines the
checksum field, &
– only verifies the checksum if
the value is nonzero
Ali Kujoory
5/31/2016
– if the computed checksum
has a value of zero
• a sender uses the all-ones
form of zero
• To verify that messages to
reach the correct
destination without
incurring the overhead of
additional header fields
– UDP extends the checksum
Not to be reproduced without permission
16
24.10 The UDP Checksum & the Pseudo Header
• UDP software includes a
pseudo header that
contains
• Similarly, to verify a
checksum
– Source, destination, & type
(PROTO = 17) fields from the
IP datagram & a UDP
datagram length
– sender adds up all 16-bit
words in 1’s complement &
then take the 1’s complement
of the sum
– a receiver must obtain the
UDP length, the source,
destination, & type fields from
the IP datagram
– the receiver appends them
to the UDP message before
verifying the checksum
• Fig. 24.2 illustrates fields in
the pseudo header
Figure 24.2 Illustration of a pseudo header used to calculate the UDP checksum.
Ali Kujoory
5/31/2016
Not to be reproduced without permission
17
24.11 UDP Encapsulation
• Each UDP datagram is encapsulated in an IP datagram
for transmission across the Internet
• Fig. 24.3 (below) illustrates the encapsulation
Figure 24.3 The encapsulation of a UDP message in an IP datagram
Ali Kujoory
5/31/2016
Not to be reproduced without permission
18