What Is the User Datagram Protocol?
The User Datagram Protocol (UDP) is a simple transport layer protocol for connectionless, unreliable datagrams. IETF RFC 768 is the official specification for UDP. In the TCP / IP model, UDP provides a simple interface above the network layer and below the application layer. UDP only provides unreliable delivery of data. Once it sends data sent from the application to the network layer, it does not retain data backup (so UDP is sometimes considered an unreliable datagram protocol). UDP only adds multiplexing and data check (fields) to the header of the IP datagram. Due to the lack of reliability, UDP applications must generally allow a certain amount of packet loss, errors, and replication. [1]
- Chinese name
- User Datagram Protocol
- Foreign name
- User Datagram Protocol, UDP
- Meaning
- UDP header field consists of 4 parts
- area
- The source port is an optional domain,
- Features
- Lack of reliability
- The User Datagram Protocol (UDP) is a simple transport layer protocol for connectionless, unreliable datagrams. IETF RFC 768 is the official specification for UDP. In the TCP / IP model, UDP provides a simple interface above the network layer and below the application layer. UDP only provides unreliable delivery of data. Once it sends data sent from the application to the network layer, it does not retain data backup (so UDP is sometimes considered an unreliable datagram protocol). UDP only adds multiplexing and data check (fields) to the header of the IP datagram. Due to the lack of reliability, UDP applications must generally allow a certain amount of packet loss, errors, and replication. [1]
User Datagram Protocol Introduction
- User Datagram Protocol (UDP) is another important protocol on the upper layer of IP. It is a connectionless, unreliable datagram transmission protocol. It only transmits the datagrams to be sent to the network and receives the datagrams from the network without establishing a connection with the remote UDP module. UDP provides services for users' network applications, such as Network File System (NFS) and Simple Network Management Protocol (SNMP). UDP preserves the message boundaries defined by the application. It neither connects messages from two applications, nor divides an application's messages into multiple parts. UDP also has its own checksum field, but when two UDP modules are connected via Ethernet only, the checksum may not be needed. [2]
User Datagram Protocol Meaning
- The UDP header field consists of four parts, two of which are optional. Each 16-bit source port and destination port are used to mark the sending and receiving application processes. Because UDP does not require a response, the source port is optional. If the source port is not used, set it to zero. Behind the destination port is a fixed length byte field. It is used to specify the length of the UDP datagram including the data part. The remaining 16-bit of the header is used to checksum the header and the data part. This part is optional, but this function is generally used in practical applications.
- Due to the lack of reliability, UDP applications must generally allow a certain amount of packet loss, errors, and replication. Some applications, such as TFTP, must add fundamental reliability mechanisms at the application layer if needed. However, most UDP applications do not require a reliable mechanism, and may even reduce performance due to the introduction of a reliable mechanism. Streaming media, real-time multimedia games, and voice over IP (VoIP) are typical UDP applications. If an application requires high reliability, the Transmission Control Protocol can be used instead of UDP.
- Due to the lack of congestion avoidance and control mechanisms, network-based mechanisms are needed to reduce the effects of congestion collapse caused by out-of-control and high-speed UDP traffic loads. In other words, because UDP senders are not able to detect congestion, basic network devices such as routers using packet queuing and drop technologies often become effective tools to reduce UDP's excessive traffic. The Datagram Congestion Control Protocol (DCCP) is designed to reduce this potential problem by adding host congestion control to high-rate UDP streams such as streaming media types.
- Many of the key applications using the UDP protocol on a typical network are somewhat similar. These applications include the Domain Name System (DNS), the simple network management protocol (SNMP), the Dynamic Host Configuration Protocol (DHCP), and the Routing Information Protocol (RIP).
User datagram protocol user data header format
User Datagram Protocol Field
- The source port is an optional field. When it is meaningful, it refers to the port of the sending process, which also assumes where the returned information should be sent in the absence of other information. If it is not used, fill in 0 in this field. The destination port is meaningful when it has a specific destination network address. Length refers to the octal representation of the length of this user datagram. (This indicates that the minimum datagram length is 8.) The checksum has 16 bits, which is obtained by inverting the sum of the digits of the IP header, UDP header, and packet header in the data. [2]
- The header is conceptually preceded by the UDP header information. It includes the source address, destination address, protocol used, and UDP length. This information prevents the information from being received by mistake. This check process is consistent with the process used in TCP.
- If the calculated check code is zero, it will be sent with all zeros. An all-zero check value means that the sender did not generate a check code.
User Datagram Protocol User Interface
- The user interface should allow the creation of a new receiving port. The receiving operations at the receiving port are: an octal number should be returned to indicate the source port and source address, allow datagram transmission, specify data, source and destination ports, and destination addresses.
IP User datagram protocol IP layer interface
- The UDP module must be able to determine the source and destination network addresses, and it must be able to know the protocol used from the packet header. One possible interface is to return the entire datagram, including the headers returned by the receive operation. Such an interface should also allow UDP to send complete datagrams with headers to IP for transmission. The consistency is determined by the IP and a check code is calculated.
User Datagram Protocol Protocol Application
- The main uses of this protocol are Internet name servers and small file transfer protocols.
- Agreement number
- When using it in IP, its protocol number is 17 (21 in octal).
User Datagram Protocol Function
- In order to identify multiple destination addresses on a given host, allow multiple applications to work on the same host, and send and receive datagrams independently, a user datagram protocol, UDP, is designed.
Use UDP protocol: TFTP, SNMP, NFS, DNS
UDP uses the underlying Internet protocol to transmit messages and, like IP, provides unreliable connectionless datagram transmission services. It does not provide functions such as message arrival confirmation, sequencing, and flow control.
User datagram protocol message format
- Each UDP packet is divided into a UDP header and a UDP data area. The header consists of four 16-bit (8-byte) fields, which respectively describe the source port, destination port, message length, and checksum of the message. The user datagram contains an 8-byte fixed-length UDP data header and a variable-length data area. Among them, the fields in the datagram header are defined as follows: [1]
- (1) The source and destination ports are used to identify the ports used by the source and destination processes of the datagram, respectively. The field length is 16 bits and a maximum of 64 k port numbers are supported. The source process does not need the destination to return a datagram. The source port field can be set to 0.
- (2) Datagram length, 16 bits, records the length of the entire datagram in bytes.
- (3) Datagram checksum, 16 bits, used for datagram checksum protection. In UDP, the checksum function is optional. If no checksum is used, the value of this field is 0.
User datagram protocol layering and encapsulation
- UDP is a transport protocol that sits on top of the IP layer. The data that the application needs to send will be encapsulated into the UDP datagram by the UDP protocol; then the UDP datagram is encapsulated and sent in an IP packet at the IP layer. [1]
- A UDP datagram contains a UDP data header and a data field. The UDP data header contains control information of the UDP protocol. The data area is used to carry high-level user data. When encapsulating, a UDP datagram must be encapsulated into an IP packet for transmission. The maximum length of a UDP datagram cannot exceed the maximum length allowed in the IP packet data area (the maximum length of an IP packet cannot exceed 64k bytes). At the UDP layer, user data is first added with a UDP header to generate a UDP datagram. At the IP layer, the entire user datagram is added with an IP packet header to generate an IP packet, which is then encapsulated into a data link frame for transmission (in the encapsulation of a data link frame, segmentation may be required). Packets use the IP packet forwarding function in the Internet to reach the receiving end. When the receiver receives a datagram, the underlying encapsulation (data link layer and IP layer) is stripped off layer by layer (this process may require reorganization of the IP), and the original datagram is submitted to the receiver's UDP-based malware. The UDP software will process the control information in the UDP data header, and submit the user data to the corresponding UDP port according to the destination port number in the datagram, waiting for the application to read it.
- Therefore, UDP data transmission is structured, that is, UDP transmits one datagram at a time, user data submitted by the application at a time is encapsulated into one datagram, and the entire datagram is transmitted as a whole on the Internet. When the transmission is successful, the data in the entire datagram is successfully received; if the transmission fails, the data in the entire datagram will disappear.
User Datagram Protocol Multiplexing, Decomposition, and Port
- The function of sending and receiving datagrams in the UDP protocol is usually implemented based on the UDP port. The UDP protocol implements port-based multiplexing. Before each application sends a datagram, it must negotiate with the operating system to obtain an available UDP port (of course, you can also assign the port yourself, but you need to ensure that there is no port conflict in the system). When an application uses this port to send datagrams, it needs to put the port number in the source port field of the UDP packet. If the source sends datagrams without a reply from the other party, you do not need to allocate a port locally. You can set the source port field to 0. [1]
- Generally, the UDP port in the operating system is similar to the ordinary I / O port, and it is a readable and writable structure. The application software implements the sending and receiving of datagrams by reading and writing to the port. A data buffer is usually included inside the UDP port, which is used to buffer the arriving datagrams and datagrams that have not been sent temporarily. In most UDP implementations, when an application negotiates with the operating system and attempts to receive datagrams using a port, the operating system will create an internal queue for the port to hold the received messages. Applications can usually specify and modify the length of the port queue.
User Datagram Protocol Features
- UDP is connectionless, that is, there is no need to establish a connection before sending data (of course, there is no connection to release at the end of sending data), so the overhead and the delay before sending data are reduced;
- Using UDP to do its best to deliver, that is, does not guarantee reliable delivery, so the host does not need to maintain a complex connection state table;
- UDP is message-oriented;
- UDP has no congestion control;
- UDP supports one-to-one, one-to-many, many-to-one, and many-to-many interactive communication;
- The overhead of UDP is small. | [2]