Slides from TCP/IP - Forouzan
Chapter 11
UDP
• Process-to-Process Communication
• User Datagram
• Checksum
• Use of UDP
• UDP Design
Forouzan Notes COSC 6377 - Fall 2000 11-1
Figure 11-1 Position of UDP in the TCP/IP protocol suite
Application
layer SMTP FTP TFTP DNS SNMP ... BOOTP
Transport
layer TCP UDP
IGMP ICMP
Network
layer IP
ARP RARP
Data link
layer
Underlying LAN or WAN
technology
Physical
layer
Forouzan Notes COSC 6377 - Fall 2000 11-2
Forouzan Notes COSC 6377 - Fall 2000 11-1
Slides from TCP/IP - Forouzan
Figure 11-2 UDP versus IP
Processes Processes
(Running application programs) (Running application programs)
... ...
Internet
Domain of IP protocol
Domain of UDP protocol
Forouzan Notes COSC 6377 - Fall 2000 11-3
Figure 11-3 Port numbers
Daytime Daytime
client server
52,000 13
UDP UDP
Data 13 52,000
13 52,000 Data
Forouzan Notes COSC 6377 - Fall 2000 11-4
Forouzan Notes COSC 6377 - Fall 2000 11-2
Slides from TCP/IP - Forouzan
Figure 11-4 IP addresses versus port numbers
...
13
13 Port number
selects the process
193.14.26.7
IP header
IP address
193.14.26.7 selects the host
13
UDP header
Forouzan Notes COSC 6377 - Fall 2000 11-5
Figure 11-5 IANA ranges
Registered
0 1,023 49,152 65,535
1,024 49,151
Well-known Dynamic
Forouzan Notes COSC 6377 - Fall 2000 11-6
Forouzan Notes COSC 6377 - Fall 2000 11-3
Slides from TCP/IP - Forouzan
Figure 11-6 Socket address
IP address Port number
200.23.56.8 69
200.23.56.8 69
Socket address
Forouzan Notes COSC 6377 - Fall 2000 11-7
Figure 11-7 User datagram format
8 bytes
Header Data
Source port number Destination port number
16 bits 16 bits
Total length Checksum
16 bits 16 bits
Forouzan Notes COSC 6377 - Fall 2000 11-8
Forouzan Notes COSC 6377 - Fall 2000 11-4
Slides from TCP/IP - Forouzan
Figure 11-8 Pseudoheader added to the UDP datagram
redaehoduesP
32-bit source IP address
32-bit destination IP address
All 0s 8-bit protocol 16-bit UDP total length
(17)
Source port address Destination port address
redaeH
16 bits 16 bits
UDP total length Checksum
16 bits 16 bits
Data
(Padding must be added to make the data a multiple of 16 bits)
Forouzan Notes COSC 6377 - Fall 2000 11-9
Figure 11-9 Checksum calculation of a simple UDP user datagram
10011001 00010010 153.18
00001000 01101001 8.105
10101011 00000010 171.2
153.18.8.105 00001110 00001010 14.10
00000000 00010001 0 and 17
171.2.14.10 00000000 00001111 15
All 0s 17 15 00000100 00111111 1087
00000000 00001101 13
1087 13 00000000 00001111 15
00000000 00000000 0 (checksum)
15 All 0s 01010100 01000101 T and E
T E S T 01010011 01010100 S and T
01001001 01001110 I and N
I N G All 0s 01000111 00000000 G and 0 (padding)
10010110 11101011 Sum
01101001 00010100 Checksum
Forouzan Notes COSC 6377 - Fall 2000 11-10
Forouzan Notes COSC 6377 - Fall 2000 11-5
Slides from TCP/IP - Forouzan
Figure 11-10 Encapsulation and decapsulation
Process Process
Message from process Message to process
UDP UDP
header UDP data header UDP data
IP IP
header IP data header IP data
Frame Frame
header Frame data header Frame data
a. Encapsulation b. Decapsulation
Forouzan Notes COSC 6377 - Fall 2000 11-11
Figure 11-11 Queues in UDP
Daytime Daytime
client server
Outgoing Incoming Outgoing Incoming
queue queue queue queue
Port 52000 Port 13
UDP UDP
Forouzan Notes COSC 6377 - Fall 2000 11-12
Forouzan Notes COSC 6377 - Fall 2000 11-6
Slides from TCP/IP - Forouzan
Figure 11-12 Multiplexing and demultiplexing
Processes Processes
UDP UDP
(Multiplexer) (Demultiplexer)
IP IP
Forouzan Notes COSC 6377 - Fall 2000 11-13
Figure 11-13 UDP design
Process Process Process
Processes
(when started)
Data Data
U Control-block
D Queues
module
P Data
Input module Control-block Output module
table
IP
UDP UDP
User datagram User datagram
Forouzan Notes COSC 6377 - Fall 2000 11-14
Forouzan Notes COSC 6377 - Fall 2000 11-7