Presentation is loading. Please wait.

Presentation is loading. Please wait.

Hyung-Min Lee©Networking Lab., 2001 Chapter 11 User Datagram Protocol (UDP)

Similar presentations


Presentation on theme: "Hyung-Min Lee©Networking Lab., 2001 Chapter 11 User Datagram Protocol (UDP)"— Presentation transcript:

1 Hyung-Min Lee©Networking Lab., 2001 Chapter 11 User Datagram Protocol (UDP)

2 Hyung-Min Lee©Networking Lab., 2001 UDP About UDP(User Datagram Protocol) : RFC 768[Postel 1980] The TCP/IP protocol suit specifies two protocols for the transport layer: UDP and TCP. UDP lies between the application layer and the IP layer and, like TCP, serves as the intermediary between the application programs and the network operations. UDP is called a connectionless, unreliable transport protocol.

3 Hyung-Min Lee©Networking Lab., 2001 Figure 11-1 Position of UDP in the TCP/IP protocol suite.

4 Hyung-Min Lee©Networking Lab., 2001 UDP 11.1 PROCESS-TO-PROCESS COMMUNICATION UDP is responsible for delivery of the message to the appropriate process. ( a process is a running application program) Port Number The local host and the remote host are defined using IP address. To define the processes, we need second identifier which are called port numbers. (The port number are integers between 0 and 65,535.) –Ephemeral port number: The client program defines itself with a port number, chosen randomly by the UDP software running on the client host. This is the ephemeral port number. –Well-known port number: The server process defines itself with a port number. TCP/IP has a decided to use universal port numbers for services; These are called Well-known port number

5 Hyung-Min Lee©Networking Lab., 2001 Figure 11-2 UDP versus IP

6 Hyung-Min Lee©Networking Lab., 2001 Figure 11-3 Port numbers Port Number…. Ephemeral(temporary) port number 52,000 Well-known(permanent) port number 13

7 Hyung-Min Lee©Networking Lab., 2001 Figure 11-4 IP addresses versus port number The destination IP address defines the host among the different hosts in the world. After the host has been selected, the port number defines one of the processes on particular host.

8 Hyung-Min Lee©Networking Lab., 2001 Figure 11-5 IANA Ranges IANA Ranges The IANA has divided the port number into three ranges: Well-known ports: The port ranging from 0 to 1,023 are assigned and controlled by IANA. Registered ports: The port ranging from 1,024 to 49,151 are assigned and controlled by IANA. Dynamic ports.: The port ranging from 49,152 to 65,535 are neither controlled nor registered.

9 Hyung-Min Lee©Networking Lab., 2001 UDP Well-known Ports for UDP PortprotocolDescription 7EchoEchoes a received datagram back to the sender 9DiscardDiscards any datagram that is received 11UsersActive Users 13DaytimeReturns the data and the time 17QuoteReturns a quote of the day 19ChargenReturns a string of character 53NameserverDomain Name Service 67BootpsServer port to download bootstrap information 68BootpcClient port to download bootstrap information 69TFTPTrivial File Transfer Protocol 111RPCRemote Procedure Call 123NTPNetwork Time Protocol 161SNMPSimple Network Management Protocol 162SNMPSimple Network Management Protocol(trap)

10 Hyung-Min Lee©Networking Lab., 2001 Figure 11-6 Socket address Sock Address The combination of an IP address and a port number is called a sock address.

11 Hyung-Min Lee©Networking Lab., 2001 UDP 11.2 USER DATAGRAM UDP packets, called user datagrams, have a fixed-size header of 8 bytes. Figure 11-7 User datagram format

12 Hyung-Min Lee©Networking Lab., 2001 UDP Source port number: The port number used by the process running on the source host. –16 bit long. –Source host is client: ephemeral port number – Source host is server : well-known port number Destination port number: The port number used by the process running on the destination host. Length: Total length of the user datagram, header plus data.(16-bit field) Checksum: Detect the errors over the entire user datagram (header + data) 11.3 CHECKSUM The pseudoheader is part of the header of the IP packet in which the user datagram is to be encapsulated for translated for transmission with some fields filled with 0s The value of the protocol field for UDP is 17.

13 Hyung-Min Lee©Networking Lab., 2001 Figure 11-8 Pseudoheader added to the UDP datagram.

14 Hyung-Min Lee©Networking Lab., 2001 UDP Checksum Calculation at Sender The sender follows these eight steps to calculate the checksum. 1.Add the pseudoheader to the UDP user datagram. 2.Fill the checksum field with zero. 3.Divide the total bits into 16-bit(two-byte)word. 4.If the total number of bytes is not even, add one byte of padding(all 0s). The padding is only for the purpose of calculating the checksum and will be discarded afterwards. 5.Add all 16-bit sections using one’s complement arithmetic. 6.Complement the result (change all 0s to 1s and all 1s to 0s) which is a 16-bit number, and insert it in the checksum field. 7.Drop the pseudoheader and any added padding. 8.Deliver the UDP user datagram to the IP software for encapsulation.

15 Hyung-Min Lee©Networking Lab., 2001 UDP Checksum Calculation at Receiver The receiver follows these six steps to calculate the checksum. 1.Add the pseudoheader to the UDP user datagram. 2.Add padding if need. 3.Divide the total bits into 16-bit sections. 4.Add all 16-bit sections using one’s complement arithmetic. 5.If the result all 0s, drop the pseudoheader and any added padding and accept the user datagram. If the result is anything else, discard the user datagram.

16 Hyung-Min Lee©Networking Lab., 2001 Figure 11-9 Checksum calculation of a simple UDP user datagram.

17 Hyung-Min Lee©Networking Lab., 2001 UDP 11.4 UDP OPERATION Connectionless Service Each user datagram sent by UDP is an independent datagram. There is no relationship between the different user datagram even if they are coming from the same source process and going to the same destination program. Each user datagram can travel a different path. Flow and Error Control UDP is unreliable transport protocol. There is no error control mechanism in UDP except for the checksum. There is no flow control, and hence no windowing mechanism. Encapsulation and Decapsulation To send a message from one process to another, the UDP protocol encapsulates and decapsulates message

18 Hyung-Min Lee©Networking Lab., 2001 Figure 11-10 Encapsulation and Decapsulation

19 Hyung-Min Lee©Networking Lab., 2001 UDP Queuing In UDP, queues are associated with ports. At the client site, when a process starts, it requests a port number from the operating system. Some implementations create both an incoming and an outgoing queue associated with each process. Other implements create only an incoming queue associate with each process. The queues function as long as the process is running. When the process terminates, the queues are destroyed.

20 Hyung-Min Lee©Networking Lab., 2001 Figure 11-11 Queues in UDP

21 Hyung-Min Lee©Networking Lab., 2001 UDP Multiplexing and Demultiplexing Multiplexing At the sender site, there may be several processes that need to send user datagrams. However, there is only one UDP. This is a many-to-one relationship and requires multiplexing. UDP accepts messages from different processes, differentiated by there assigned port number. After adding the header, UDP passes the user datagram to IP. Demultiplexing At the receiver site, there is only one UDP. However, we may have many processes that can receive user datagram. This is a one-to-many relationship and requires demultiplexing. UDP receives user datagram from IP. After error checking and dropping of the header, UDP delivers each message to the appropriate process based on the port number.

22 Hyung-Min Lee©Networking Lab., 2001 Figure 11-12 Multiplexing and Demultiplexing

23 Hyung-Min Lee©Networking Lab., 2001 UDP 11.5 USE OF UDP FTP (File Transfer Protocol) TFTP (Trivial File Transfer Protocol) Multicasting and Broadcasting SNMP (Simple Network Management Protocol) RIP (Routing Information Protocol) 11.6 UDP DESIGN UDP package involves five components: a control-block table, input queues, a control-block module, an input module, and an output module. Control-Block Table UDP has a control-block table to keep track of the open ports. Each entry in this table has a minimum of four fields: –The State: FREE, IN-USE –Process ID, –Port Number, –The corresponding queue number.

24 Hyung-Min Lee©Networking Lab., 2001 Figure 11-13 UDP design

25 Hyung-Min Lee©Networking Lab., 2001 UDP Input Queues Our UDP design uses a set of input queues, one for each process. In this design, we do not use output queues. Control-Block Module The control-block module is responsible for the management of the control-block table. Receive: a process ID and a port number 1.Search the control block table for a FREE entry. 1.If(not found) 1.Delete an entry using a predefined strategy. 2.Create a new entry with the state IN-USE. 3.Enter the process ID and the port number. 2.Return.

26 Hyung-Min Lee©Networking Lab., 2001 UDP Output Module The output module is responsible for creating and sending user datagrams. Receive: data and information from a process 1.Create a UDP user datagram. 2.Send the user datagram. 3.Return.


Download ppt "Hyung-Min Lee©Networking Lab., 2001 Chapter 11 User Datagram Protocol (UDP)"

Similar presentations


Ads by Google