The User Datagram Protocol (UDP) is a communications protocol that is a part of the Internet Protocol Suite and is designed with the assumption that the Internet Protocol (IP) is the underlying protocol. The protocol was designed by David Patrick Reed and it's specification was published in 1980 in RFC768. RFC768 is the original specification for the protocol and the document was edited and published on the 28th of August, 1980, by Jon Postel. The User Datagram Protocol (UDP) is a part of the transport layer of the Internet Protocol Layer, and alongside TCP, is probably viewed as the most important protocol of the transport layer.
David Patrick Reed, designer of the User Datagram Protocol (UDP)
The Internet Protocol Suite has four layers (application>transport>internet>link) with application layers protocols - such as HTTP protocol for the World Wide Web - using transport layer protocols to reliable or quickly transport data for them. Transport layer protocols then use internet layer protocols - the Internet Protocol (IP) (version 4 and 6) - to envelop their data through encapsulation and the Internet Protocol (IP) delivers the data; with transport layer protocols checking the transport for errors etc.
The User Datagram Protocol (UDP) and the Transmission Control Protocol (TCP) tend to be the two transport layer protocols that application layer protocols use. The difference between the two protocols is that TCP provides a connection based transmission model, and UDP provides a connectionless ' best-effort' based transmission model. This results in TCP providing a slower and more reliable delivery of application layer data, whereas UDP provides a faster and unreliable delivery of data. UDP is viewed as a lightweight, simple and quick transport layer protocol, whereas TCP is complex, reliable and slow.
RFC768 describes UDP as the following: "The protocol is transaction oriented, and delivery and duplicate protection are not guaranteed. Applications requiring ordered reliable delivery of streams of data should use the Transmission Control Protocol."
The User Datagram Protocol (UDP) is not suitable for many application layer protocols, because it does not guarantee a reliable delivery of data. UDP is a connectionless based transmission model: which means that no 'handshake' is conducted between the host computer sending the data and the host computer receiving the data. TCP on the other hand - the other option that application layer protocol have - checks that every byte that is sent is received and is received in the correct order.
While application layers can use either UDP or TCP, some will primarily use TCP: such as SMTP, an email transport protocol, that needs to ensure that an email message is received exactly how it was sent. Where UDP is used is for Internet services where speed over reliability is required: streaming media, online gaming, Voice over IP, VoIP and IP telephony. UDP is also useful for application layer protocols that need to perform simple queries: NTP and DNS for example.
UDP functions in a similar fashion to TCP: with UDP accepting a data stream from application layer protocols, and then creating a data segment that is enveloped into an IP datagram / packet. Each UDP data segment feature a header, which includes information to help route the data, TCP has ten fields within it's header, and UDP has four fields within it's header. The four UDP header fields are as follows:
As stated, through a system of encapsulation, the UDP datagram will be inserted into a Internet Protocol (IP) datagram. The Internet Protocol (IP) will handle the delivery of data, because the Internet Protocol (IP) datagram header includes the address of the source and destination computer. When the IP address is combined with the UDP port number, this ensures that the data is sent to the correct application at the host computer. IANA assigns application layer protocols to unique UDP and TCP port numbers. The IP address can be likened to the address of a house, and the port number of UDP as a room within that house.