User Datagram Protocol (UDP) is a connectionless transport layer protocol in ISO reference model, which provides simple and unreliable transaction-oriented information transmission service. UDP protocol is basically the interface between IP protocol and upper layer protocol. UDP protocol is suitable for ports to distinguish multiple applications running on the same device.
Since most network applications run on the same machine, the computer must be able to ensure that the software program on the destination machine can get the data packet from the source machine, and the source computer can receive the correct reply. This is done by using the "port number" of UDP. For example, if a workstation wants to use the domain name service system on workstation 128. 1.123.1,it will give the packet a destination address128.1and insert the destination port number 53 in the UDP header. The source port number identifies the application that the local machine requests domain name service, and all response packets generated by the destination station need to be assigned to this port of the source host. For a detailed introduction of UDP ports, please refer to related articles.
Unlike TCP, UDP does not provide reliable mechanism, flow control and error recovery functions for IP protocol. Because UDP is relatively simple, the UDP header contains fewer bytes and consumes less load than TCP.
UDP is suitable for situations where TCP reliability mechanism is not needed, for example, when high-level protocols or applications provide error and flow control functions. UDP is a transport layer protocol, which serves many well-known application layer protocols, including Network File System (NFS), Simple Network Management Protocol (SNMP), Domain Name System (DNS) and Simple File Transfer System (TFTP).
Protocol architecture
Source port-16 bits. The source port is an optional field. When used, it represents the sender's port, and it is also considered as a reply port that needs to be addressed without other information. Otherwise, set the value to 0.
Destination port-16 bits. In the case of a special Internet destination address, the destination port is meaningful.
Length-16 bits. An eight-bit user datagram includes a protocol header and data. The minimum length is 8.
Checksum-16 bits. The sum of IP protocol header, UDP protocol header and data bits, and finally the information pseudo protocol header filled with 0. If necessary, it can be composed of two octets.
Data—Contains upper-level data information.
Related links /protocol/rfc768.pdf: User Datagram Protocol (UDP) specification.
Http://www.iana.org/assignments/port-numbers:UDP and TCP port numbers