User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on...

23
User Datagram User Datagram Protocol (UDP) Protocol (UDP) Chapter 11 Chapter 11

Transcript of User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on...

Page 1: User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.

User Datagram Protocol User Datagram Protocol (UDP)(UDP)

Chapter 11Chapter 11

Page 2: User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.

Know TCP/IP transfers datagrams aroundKnow TCP/IP transfers datagrams around Forwarded based on destination’s IP addressForwarded based on destination’s IP address At IP layer, destination address identifies hostAt IP layer, destination address identifies host

Made no further distinction about which application on Made no further distinction about which application on the host gets the datagramthe host gets the datagram

This chapter extends TCP/IP protocol This chapter extends TCP/IP protocol suitesuite Adds mechanism to distinguish among hostsAdds mechanism to distinguish among hosts Multiple applications on a given computer can Multiple applications on a given computer can

send and receive datagrams independentlysend and receive datagrams independently

Page 3: User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.

The Ultimate DestinationThe Ultimate Destination

Most OSs support multiprogrammingMost OSs support multiprogramming Multiple applications execute simultaneouslyMultiple applications execute simultaneously In OS terms, each executing program is a In OS terms, each executing program is a

process, task, application program, or user process, task, application program, or user level processlevel process

Systems are called Systems are called multitasking systemsmultitasking systems

Page 4: User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.

Is a process the ultimate destination?Is a process the ultimate destination? Seems natural; but is a bit misleadingSeems natural; but is a bit misleading

Processes are created and destroyed dynamicallyProcesses are created and destroyed dynamically

Want to replace processes without notifying sendersWant to replace processes without notifying senders

Want to identify destinations by functionWant to identify destinations by function Not by process that implements themNot by process that implements them

Single process may handle multiple functionsSingle process may handle multiple functions Want process to decide which function the sender wantsWant process to decide which function the sender wants

So, we will abstract the problemSo, we will abstract the problemImagine each machine has a set of Imagine each machine has a set of protocol portsprotocol ports

Each port identified by a positive integerEach port identified by a positive integer

Local OS provides means to specify or access a portLocal OS provides means to specify or access a port

Page 5: User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.

Most OS’s provide synchronous port accessMost OS’s provide synchronous port access Computation stops during port access operationComputation stops during port access operation

Block process extracting data if no data thereBlock process extracting data if no data there

Most ports are bufferedMost ports are buffered Puts waiting data in a finite queuePuts waiting data in a finite queue

To communicate with a foreign portTo communicate with a foreign port Sender must know IP address & protocol port #Sender must know IP address & protocol port # Messages must carryMessages must carry

Destination port on the machine receiving the msgDestination port on the machine receiving the msg

Source port on the machine sending the msgSource port on the machine sending the msg

Page 6: User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.

User Datagram Protocol (UDP)User Datagram Protocol (UDP)

Provides primary mechanism for Provides primary mechanism for application programs to swap datagramsapplication programs to swap datagrams Provides protocol ports to distinguish among Provides protocol ports to distinguish among

multiple executing programsmultiple executing programs Uses IP to transport messages between Uses IP to transport messages between

machinesmachines Provides same unreliable, connectionless imageProvides same unreliable, connectionless image

No acknowledgements; no ordering of incoming msgsNo acknowledgements; no ordering of incoming msgs

No feedback for rate control; can lose messagesNo feedback for rate control; can lose messages

Page 7: User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.

Application programs have full responsibility for:Application programs have full responsibility for:

ReliabilityReliability

Message lossMessage loss

DuplicationDuplication

Out-of-order deliveryOut-of-order delivery

Loss of connectivityLoss of connectivity Unfortunately, most application programmers Unfortunately, most application programmers

ignore this responsibilityignore this responsibility

Testing is usually done in controlled, reliable LANsTesting is usually done in controlled, reliable LANs

Fail dramatically when used in TCP/IP internetFail dramatically when used in TCP/IP internet

Page 8: User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.

Format of UDP MessagesFormat of UDP Messages

Each UDP message is a Each UDP message is a user datagramuser datagram Has a header and data areaHas a header and data area

0 16 310 16 31

UDP Source PortUDP Source Port UDP Destination PortUDP Destination Port

UDP Message LengthUDP Message Length UDP ChecksumUDP Checksum

DataData

. . .. . .

Page 9: User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.

UDP Pseudo-HeaderUDP Pseudo-Header

Checksum can cover data in datagramChecksum can cover data in datagram Need to ensure more than thatNeed to ensure more than that Datagram only has protocol port numberDatagram only has protocol port number Correct destination includes specific machineCorrect destination includes specific machine Want to compute checksum on destination IP as Want to compute checksum on destination IP as

well as UDP datagramwell as UDP datagram

Constructs pseudo-header and includes Constructs pseudo-header and includes in checksum computationin checksum computation

Page 10: User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.

Sender computes checksum over pseudo-header Sender computes checksum over pseudo-header and datagramand datagram

Only datagram gets sentOnly datagram gets sent Receiver reconstructs pseudo-header by Receiver reconstructs pseudo-header by

extracting fields from the IP headerextracting fields from the IP header

0 8 16 310 8 16 31

Source IP Address

Destination IP Address

Zero Proto UDP Length

UDP Source PortUDP Source Port UDP Destination PortUDP Destination Port

UDP Message LengthUDP Message Length UDP ChecksumUDP Checksum

DataData

. . .. . .

Pseudo-header

UDP datagram

Page 11: User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.

UDP Encapsulation & Protocol UDP Encapsulation & Protocol LayeringLayering

UDP is our first transport protocol UDP is our first transport protocol exampleexample

ApplicationApplication

User Datagram (UDP)User Datagram (UDP)

Internet (IP)Internet (IP)

Network InterfaceNetwork Interface

Page 12: User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.

Layering above UDP means complete Layering above UDP means complete UDP message (header and data) is UDP message (header and data) is encapsulated in an IP datagramencapsulated in an IP datagram UDP datagram in IP datagram data areaUDP datagram in IP datagram data area IP datagram in frame data areaIP datagram in frame data area

Layering provides division of dutiesLayering provides division of duties IP layer identifies source & destination hostsIP layer identifies source & destination hosts UDP layer identifies source or destination ports UDP layer identifies source or destination ports

within a hostwithin a host

Page 13: User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.

Figure 11.4

Page 14: User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.

Layering & UDP ChecksumLayering & UDP Checksum

Violation of layering rules with checksumViolation of layering rules with checksum Pseudo-header needs source & dest IP addressPseudo-header needs source & dest IP address

UDP must interact with IP layer to get theseUDP must interact with IP layer to get these

Regardless of method, still interacts Regardless of method, still interacts Violates separation of functionality by layeringViolates separation of functionality by layering

UDP is tightly integrated with IPUDP is tightly integrated with IP

Compromise made for practical reasonsCompromise made for practical reasons

Page 15: User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.

UDP Multiplexing, Demultiplexing,UDP Multiplexing, Demultiplexing, & Ports & Ports

Thru the layers, SW must mux and demux Thru the layers, SW must mux and demux among multiple objects at next layeramong multiple objects at next layer

UDP provides another example of thisUDP provides another example of this Accepts UDP datagrams from many application Accepts UDP datagrams from many application

programsprograms Passes to IP for transmissionPasses to IP for transmission Takes arriving datagramsTakes arriving datagrams Passes each to appropriate application programPasses each to appropriate application program

Page 16: User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.

Figure 11.5

Page 17: User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.

Conceptually, mux & demux occurs at portsConceptually, mux & demux occurs at ports In practice, little more involvedIn practice, little more involved

Applications negotiate with OS to obtain a port Applications negotiate with OS to obtain a port protocol and associated port numberprotocol and associated port number

One assigned, application puts the port number in all One assigned, application puts the port number in all outgoing UDP datagramsoutgoing UDP datagrams

Think of ports as queuesThink of ports as queuesOS creates internal queue when provides portOS creates internal queue when provides port

UDP receives datagram, see if port # matches oneUDP receives datagram, see if port # matches one If not, sends port unreachable ICMP error msg, discardsIf not, sends port unreachable ICMP error msg, discards If is, enqueues datagram at port for application programIf is, enqueues datagram at port for application program

If port full, get error and datagram discardedIf port full, get error and datagram discarded

Page 18: User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.

Reserved & Available PortsReserved & Available Ports

How should port numbers be assigned?How should port numbers be assigned? Two computers must agree on port numbersTwo computers must agree on port numbers

AA wants file from wants file from BB; needs to know what port the file ; needs to know what port the file transfer program on transfer program on BB uses uses

Two fundamental approachesTwo fundamental approaches Central authorityCentral authority Dynamic bindingDynamic binding

Page 19: User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.

Central AuthorityCentral Authority Everyone agrees that central authority assignsEveryone agrees that central authority assigns List of assignments will be publishedList of assignments will be published All software will be built according to the listAll software will be built according to the list Also called Also called universal assignmentuniversal assignment

Called Called well-known port assignmentswell-known port assignments

Dynamic BindingDynamic Binding Ports not globally knownPorts not globally known Software assigns ports when neededSoftware assigns ports when needed

Must send request to computer to learn of assignmentsMust send request to computer to learn of assignments

Target machine replies with the port number to useTarget machine replies with the port number to use

Page 20: User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.

TCP/IP uses hybrid approachTCP/IP uses hybrid approach Some ports globally assigned a prioriSome ports globally assigned a priori Many left available for local sites or applicationsMany left available for local sites or applications

Low values going up are assignedLow values going up are assigned

Higher values left openHigher values left open

Page 21: User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.
Page 22: User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.

SummarySummary

Can have multiple applications executingCan have multiple applications executing UDP distinguishes among these processesUDP distinguishes among these processes Uses two 16-bit integers for port numbersUses two 16-bit integers for port numbers Some are pre-assigned (well-known)Some are pre-assigned (well-known) Some available for arbitrary useSome available for arbitrary use

Page 23: User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.

UDP is a thin protocolUDP is a thin protocol Not add significantly to semantics of IPNot add significantly to semantics of IP Provides way for applications to use IP to Provides way for applications to use IP to

communicatecommunicateUnreliable, connectionlessUnreliable, connectionless

UDP lies in transport layerUDP lies in transport layer Conceptual independence between it and Conceptual independence between it and

internet layer is somewhat violatedinternet layer is somewhat violated