One other important protocol in the TCP/IP suite is User Datagram Protocol (UDP). This protocol is basically a scaled-down version of TCP. Just like TCP, this protocol provides delivery of data between applications running on hosts on a TCP/IP network. But, unlike TCP, it does not sequence the data and does not care about the order in which the segments arrive at the destination. Because of this we consider this to be an unreliable protocol. UDP is also considered to be a connectionless protocol since no virtual circuit is established between two endpoints before the data transfer takes place.
Because it does not provide many features that TCP does, UDP uses much less network resources than TCP. Two types of applications commonly use UDP:
- applications that are tolerant of the lost data – VoIP (Voice over IP) uses UDP because if a voice packet is lost, by the time the packet would be retransmitted, too much delay would have occurred. Also, the voice would be unintelligible.
- applications that have some application mechanism to recover lost data – Network File System (NFS) performs recovery with application layer code, so UDP is used as a transport-layer protocol.
The UDP header is 8 bytes long.
Fields of User Datagram Protocol header
Here is a description of each field:
- source port – the port number of the application on the host sending the data.
- destination port – the port number of the application on the host receiving the data.
- length – the length of the UDP header and data.
- checksum – checksum of both the UDP header and its data fields.
UDP is a Transport layer protocol (Layer 4 of the OSI model).