Introduction to Data Communications
Previous 59. User Datagram Protocol (UDP) Next

tri59. User Datagram Protocol (UDP)

The User Datagram Protocol (UDP) is a connectionless host to host service that operates at the Transport layer of the OSI model. UDP relies on the upper layer protocol for error correction and reliable service. The protocol is transaction oriented, and delivery and duplicate protection are not guaranteed. The major uses of this protocol are DNS and TFTP.

UDP has a small header and for all intensive purposes adds Port addressing to the IP header. The IP header routes datagrams to the correct host on the network and UDP routes the datagram to the correct application.


59a. UDP Header

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1516 17 18 19 20 21 22 2324 25 26 27 28 29 30 31
Source Port (16 bits)Destination Port (16 bits)
Length (16 bits)Checksum (16 bits)
Data

Source Port

The Source Port is a 16 bit number that Indicates the upper level service that the source is transmitting. Appendix I is a complete listing of well known ports. UDP allows port numbers to be in the range from 0 to 65,535. The Source Port is optional and if not used, a field of 0s is inserted. Clients will have a unique port number assigned to them by the server. Typically the number will be above 8,000.

Destination Port

The Destination Port is a 16 bit number that Indicates the upper level service that the source wishes to communicate with at the destination.

Length

The Length field is 16 bits long and indicates the length of the UDP datagram and has a maximum value of 65, 535 bytes and a minimum value of 8 bytes.

Checksum

The Checksum field is 16 bits long and calculates a checksum based on the UDP header, Data field and what is called the UDP Pseudo header. The UDP Pseudo header consists of the Source IP Address, Destination IP Address, Zero, IP Protocol field and UDP Length. The IP Protocol field value is 17 for UDP.

Data

The data field contains the IP header and data. The Data field may be padded with zero octets at the end (if necessary) to make a multiple of two octets.


Introduction to Data Communications
Previous Table of Contents Next