Chapter 11 User Datagram Protocol Objectives Upon completion

  • Slides: 27
Download presentation
Chapter 11 User Datagram Protocol Objectives Upon completion you will be able to: •

Chapter 11 User Datagram Protocol Objectives Upon completion you will be able to: • Be able to explain process-to-process communication • Know the format of a UDP user datagram • Be able to calculate a UDP checksum • Understand the operation of UDP • Know when it is appropriate to use UDP • Understand the modules in a UDP package TCP/IP Protocol Suite 1

Figure 11. 1 TCP/IP Protocol Suite Position of UDP in the TCP/IP protocol suite

Figure 11. 1 TCP/IP Protocol Suite Position of UDP in the TCP/IP protocol suite 2

11. 1 PROCESS-TO-PROCESS COMMUNICATION Before we examine UDP, we must first understand host-to-host communication

11. 1 PROCESS-TO-PROCESS COMMUNICATION Before we examine UDP, we must first understand host-to-host communication and process-to-process communication and the difference between them. The topics discussed in this section include: Port Numbers Socket Addresses TCP/IP Protocol Suite 3

Figure 11. 2 TCP/IP Protocol Suite UDP versus IP 4

Figure 11. 2 TCP/IP Protocol Suite UDP versus IP 4

Figure 11. 3 TCP/IP Protocol Suite Port numbers 5

Figure 11. 3 TCP/IP Protocol Suite Port numbers 5

Figure 11. 4 TCP/IP Protocol Suite IP addresses versus port numbers 6

Figure 11. 4 TCP/IP Protocol Suite IP addresses versus port numbers 6

Note: The well-known port numbers are less than 1024. TCP/IP Protocol Suite 7

Note: The well-known port numbers are less than 1024. TCP/IP Protocol Suite 7

Table 11. 1 Well-known ports used with UDP TCP/IP Protocol Suite 8

Table 11. 1 Well-known ports used with UDP TCP/IP Protocol Suite 8

Figure 11. 6 TCP/IP Protocol Suite Socket address 9

Figure 11. 6 TCP/IP Protocol Suite Socket address 9

11. 2 USER DATAGRAM UDP packets are called user datagrams and have a fixed-size

11. 2 USER DATAGRAM UDP packets are called user datagrams and have a fixed-size header of 8 bytes. TCP/IP Protocol Suite 10

Figure 11. 7 TCP/IP Protocol Suite User datagram format 11

Figure 11. 7 TCP/IP Protocol Suite User datagram format 11

Note: UDP length = IP length − IP header’s length TCP/IP Protocol Suite 12

Note: UDP length = IP length − IP header’s length TCP/IP Protocol Suite 12

11. 3 CHECKSUM UDP checksum calculation is different from the one for IP and

11. 3 CHECKSUM UDP checksum calculation is different from the one for IP and ICMP. Here the checksum includes three sections: a pseudoheader, the UDP header, and the data coming from the application layer. The topics discussed in this section include: Checksum Calculation at Sender Checksum Calculation at Receiver Optional Use of the Checksum TCP/IP Protocol Suite 13

Figure 11. 8 TCP/IP Protocol Suite Pseudoheader for checksum calculation 14

Figure 11. 8 TCP/IP Protocol Suite Pseudoheader for checksum calculation 14

11. 4 UDP OPERATION UDP uses concepts common to the transport layer. These concepts

11. 4 UDP OPERATION UDP uses concepts common to the transport layer. These concepts will be discussed here briefly, and then expanded in the next chapter on the TCP protocol. The topics discussed in this section include: Connectionless Services Flow and Error Control Encapsulation and Decapsulation Queuing Multiplexing and Demultiplexing TCP/IP Protocol Suite 15

Figure 11. 10 TCP/IP Protocol Suite Encapsulation and decapsulation 16

Figure 11. 10 TCP/IP Protocol Suite Encapsulation and decapsulation 16

Figure 11. 11 TCP/IP Protocol Suite Queues in UDP 17

Figure 11. 11 TCP/IP Protocol Suite Queues in UDP 17

Figure 11. 12 TCP/IP Protocol Suite Multiplexing and demultiplexing 18

Figure 11. 12 TCP/IP Protocol Suite Multiplexing and demultiplexing 18

11. 5 USE OF UDP We discuss some uses of the UDP protocol in

11. 5 USE OF UDP We discuss some uses of the UDP protocol in this section. TCP/IP Protocol Suite 19

11. 6 UDP PACKAGE To show UDP handles the sending and receiving of UDP

11. 6 UDP PACKAGE To show UDP handles the sending and receiving of UDP packets, we present a simple version of the UDP package. The UDP package involves five components: a control-block table, input queues, a controlblock module, an input module, and an output module. The topics discussed in this section include: Control-Block Table Input Queues Control-Block Module Input Module Output Module TCP/IP Protocol Suite 20

Figure 11. 13 TCP/IP Protocol Suite UDP design 21

Figure 11. 13 TCP/IP Protocol Suite UDP design 21

n n Control-Block Table In our package, UDP has a control-block table to keep

n n Control-Block Table In our package, 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, which can be FREE or INUSE, the process ID, the port number, and the corresponding queue number. TCP/IP Protocol Suite 22

n n Input Queues Our UDP package uses a set of input queues, one

n n Input Queues Our UDP package uses a set of input queues, one for each process. In this design, we do not use output queues. TCP/IP Protocol Suite 23

1 UDP_Control_Block_Module (process ID, port number) 2{ 3 Search the table for a FREE

1 UDP_Control_Block_Module (process ID, port number) 2{ 3 Search the table for a FREE entry. 4 if (not found) 5 Delete one entry using a predefined strategy. 6 Create a new entry with the state IN-USE 7 Enter the process ID and the port number. 8 Return. 9 } // End module TCP/IP Protocol Suite 24

Table 14. 3 Input Module 1 UDP_INPUT_Module (user_datagram) 2{ 3 Look for the entry

Table 14. 3 Input Module 1 UDP_INPUT_Module (user_datagram) 2{ 3 Look for the entry in the control_block table 4 if (found) 5{ 6 Check to see if a queue is allocated 7 If (queue is not allocated) 8 allocate a queue 9 else 10 enqueue the data 11 } //end if TCP/IP Protocol Suite 25

12 else 13 { 14 Ask ICMP to send an "unreachable port" message 15

12 else 13 { 14 Ask ICMP to send an "unreachable port" message 15 Discard the user datagram 16 } //end else 17 18 Return. 19 } // end module TCP/IP Protocol Suite 26

1 UDP_OUTPUT_MODULE (Data) 2{ 3 Create a user datagram 4 Send the user datagram

1 UDP_OUTPUT_MODULE (Data) 2{ 3 Create a user datagram 4 Send the user datagram 5 Return. 6} TCP/IP Protocol Suite 27