User Datagram Protocol (UDP)
- Sometimes it is more important that communications be faster than they are reliable
- connection-oriented process of TCP adds lots of header bytes to each packet
User Datagram Protocol (UDP) is a connectionless, non-guaranteed method of communication with no sequencing or acknowledgements.
- works at the Transport layer
- no guarantee regarding the:
- delivery of messages
- sequence in which packets are received
- mechanism for retransmitting lost or damaged packets
- suitable for applications that:
- send small amounts of data in each packet
- do not require acknowledgement of receipt
- can tolerate missing or out-of-order packets
- application layer or software logic can be used to control delivery reliability
- uses:
- Application layer protocols that need to send multicast or broadcast traffic
- applications that transfer time-sensitive data but do not require complete reliability
- e.g., voice or video
- using small packets means that if a few are lost or arrive out of order, it results in only minor glitches
- missing data manifests as glitches rather than application errors or complete connection failures
- reduced overhead means that delivery is faster
- header size is 8 bytes
- structure of a UDP header:
| Field | Explanation |
|---|---|
| Source port | UDP port of sending host. |
| Destination port | UDP port of destination host. |
| Message length | Size of the UDP packet. |
| Checksum | Ensures validity of the packet. |
Examples
- examples of protocols that use UDP:
- Dynamic Host Configuration Protocol (DHCP)
- used by clients to request IP configuration information from a server
- uses broadcast transmissions, which are not supported by TCP, so it must use UDP
- if a response packet is not received, the client just restarts the process and tries again repeatedly, until timing out
- Trivial File Transfer Protocol (TFTP)
- used by network devices to obtain a configuration file
- application protocol uses its own acknowledgement messaging, so it does not require TCP
- Dynamic Host Configuration Protocol (DHCP)