This site requires JavaScript for navigation. Please enable JavaScript for the best learning experience.
 

User Datagram Protocol (UDP) is a protocol used for transport of data across an Internet Protocol (IP) based network. User Datagram Protocol (UDP) does not perform handshaking as TCP does, or check for errors, or even to see if the transmitted data was received, so User Datagram Protocol (UDP) is referred to as an unreliable, connectionless protocol. However, because User Datagram Protocol (UDP) skips the handshaking and is focused on pure transmission, User Datagram Protocol (UDP) has lower overhead and is thus faster than TCP. UDP will provide better throughput on a network where the physical and datalink layer protocols are reliable.

Domain Name Service, Trivial File Transfer Protocol and Simple Network Management Protocol all use User Datagram Protocol (UDP).

UDP DATAGRAM FORMAT

A User Datagram Protocol (UDP) datagram is encapsulated within an IP datagram and therefore is prefixed with IP header information.

    0      7 8     15 16    23 24    31
   +--------+--------+--------+--------+
   |     Source      |   Destination   |
   |      Port       |      Port       |
   +--------+--------+--------+--------+
   |                 |                 |
   |     Length      |    Checksum     |
   +--------+--------+--------+--------+
   |
   |          data octets ...
   +---------------- ...
   

UDP DATAGRAM FIELDS

Source Port
The source port is the virtual port number assigned by the local computer when it transmits data to a remote machine. This is typically a number above 1023 and is the next highest number not already in use. This field is not always used, but when it is, it should indicate the port number the remote machine should use when sending any replies back to the source.
Destination Port
The destination port is usually a 'well known port number' of a service, such as 69 for Trivial File Transfer Protocol (TFTP), or 53 for Domain Name Service (DNS). These virtual port numbers allow the remote machine to recognize a request for a particular type of service and to match up endpoints for multiplexed connections. When used with a source port, this allows a remote machine to recognize a data connection.
Length
Length is specified as a number of octets, and since it's a 16-bit value, it provides for a datagram of up to 65,535 bytes, including the UDP datagram header and data payload.
Checksum
A checksum is calculated using the the 16-bit one's complement of the one's complement sum of data pulled from the IP header, the User Datagram Protocol (UDP) header, and some of the data. This data is padded with zeroes so that it is a multiple of two octets before the checksum algorithm is run.

The purpose of UDP is to break up a stream of data into datagrams, add a source and destination port information, a length and a checksum. It is the receiving application's responsibility to detect and recover lost or damaged packets, as UDP doesn't take care of this.

You can think of UDP as riding "inside" IP. The networking layer protocol IP handles packet ordering, segmentation and re-assembly, as well as the routing between the source and destination computer systems.

 


Bookmark this page and SHARE:  

Search

Support InetDaemon.Com

Get Tutorials in your INBOX!

Free Training