Introduction to udp transmission protocol, udp transmission protocol
What is UDP?
UDP is short for User datav Protocol. The Chinese name is the User Datagram Protocol. It is a connectionless transport layer Protocol in the OSI (Open System Interconnection, Open System Interconnection) Reference Model, it provides simple and unreliable information transmission services for transactions. ietf rfc 768 is a formal specification of UDP. The Protocol number of UDP in IP packets is 17.
The full name of UDP protocol is User Datagram Protocol [1]. It is used to process data packets in the same way as TCP protocol in the network. It is a connectionless protocol. In the OSI model, the fourth layer is the transport layer, which is the top layer of the IP protocol. UDP does not provide packet grouping, assembly, and sorting. In other words, when a packet is sent, it cannot know whether it is safe and complete. UDP is used to support network applications that need to transmit data between computers. Network applications in customer/Server mode, including network video conferencing systems, must use UDP protocol.
Like the well-known TCP (Transport Control Protocol) protocol, UDP is directly located at the top layer of the IP (Internet Protocol) protocol. According to the OSI (Open System Interconnection) reference model, both UDP and TCP are transport layer protocols. The main function of UDP protocol is to compress network data traffic into data packets. A typical data packet is the unit of binary data transmission. The first eight bytes of each data packet are used to contain header information, and the remaining bytes are used to contain specific transmitted data.
Chinese Name User Datagram Protocol Foreign Name User datav Protocol features unreliable fast transmission short name UDP
Protocol
UDP is a connectionless transport layer protocol in the OSI reference model. It is mainly used for transmission that does not require the arrival of group sequence. The inspection and sorting of group Transmission sequence is completed by the application layer, provides a simple and unreliable transaction-oriented information transfer service. UDP is basically an interface between the IP protocol and the upper-layer protocol. The applicable ports of UDP protocol run multiple applications on the same device.
UDP provides connectionless communication and does not guarantee the reliability of transmitted data packets. It is suitable for transmitting a small amount of data at a time. The reliability of UDP transmission is the responsibility of the application layer.
UDP packets do not have reliability assurance, sequence assurance, and traffic control fields, so the reliability is poor. However, because the UDP protocol has few control options, the latency is small during data transmission and the data transmission efficiency is high, it is suitable for applications with low reliability requirements, or applications that guarantee reliability, such as DNS, TFTP, and SNMP.
When Will UDP be used?
When selecting the protocol, you must be cautious when selecting UDP. In an environment with unsatisfactory network quality, UDP packet loss may be serious. However, due to the characteristics of UDP: it is not a connection protocol, so it has the advantages of low resource consumption and high processing speed. Therefore, most of the audio, video, and common data are transmitted using UDP, because even if one or two packets are occasionally lost, they do not have much impact on the received results. For example, the ICQ and QQ used for our chat are the UDP protocol.
Header
The UDP protocol uses the port number to reserve its own data transmission channels for different applications. The UDP and TCP Protocols use this mechanism to support sending and receiving data simultaneously for multiple applications at the same time. The data sender (either a client or a server) sends UDP packets through the source port, while the data receiver receives data through the target port. Some network applications can only use static ports reserved or registered for them in advance, while other network applications can use unregistered dynamic ports. Because the UDP header uses two bytes to store the port number, the valid range of the port number is from 0 to 65535. Generally, a port number larger than 49151 represents a dynamic port.
The length of a datagram refers to the total number of bytes including the header and data. Because the header length is fixed, this field is mainly used to calculate the variable-length data section (also known as data load ). The maximum length of a datagram varies depending on the operating environment. Theoretically, the maximum length of a datagram containing a header is 65535 bytes. However, in some practical applications, the size of data packets is often limited, and sometimes reduced to 8192 bytes.
UDP uses the checksum value in the header to ensure data security. The verification value is calculated by the Data sender using a special algorithm. After it is passed to the receiver, it needs to be re-calculated. If a data packet is tampered with by a third party during transmission or damaged due to line noise or other reasons, the sent data does not match the verification calculation value of the receiver. Therefore, the UDP protocol can detect whether an error occurs. This is different from the TCP protocol, which requires a verification value.
Many link layer protocols provide error checks, including popular Ethernet protocols. You may want to know why UDP also provides checks and verifications. The reason is that the protocols below the link layer may not provide error detection for some channels between the source end and the terminal. Although UDP provides error detection, when an error is detected, UDP does not make error correction, but simply throws the corrupted message segment or provides warning information to the application.
UDP Helper is used to relay the broadcast packets of a specified UDP port. It converts the broadcast packets of a specified UDP port into a single broadcast packet sent to the specified server and serves as a relay.
In the TCP/IP layer model, UDP is located above the IP layer. The application accesses the UDP layer and then uses the IP layer to transmit the datagram. The IP layer header specifies the source host and destination host addresses, while the UDP layer header specifies the source port and destination port on the host.
Features
(1) UDP is a connectionless protocol. The source end and the terminal do not establish a connection before data transmission. When UDP
It simply captures data from the application and throws it to the network as quickly as possible. At the sending end, the speed of UDP data transmission is limited only by the speed at which the application generates data, the ability of the computer, and the transmission bandwidth. at the receiving end, UDP puts each message segment in the queue, the application reads a message segment from the queue each time.
(2) Since no connection is established for data transmission, you do not need to maintain the connection status, including the sending and receiving status. Therefore, a server can transmit the same message to multiple clients at the same time.
(3) The title of the UDP information package is very short, with only 8 bytes. The additional overhead of the 20 bytes information package of TCP is very small.
(4) throughput is not adjusted by the congestion control algorithm, but is limited by the data generation rate, transmission bandwidth, source end and terminal host performance of the application software.
(5) UDP uses the best effort to deliver, that is, it does not guarantee reliable delivery, so the host does not need to maintain a complex link status table (there are many parameters ).
(6) UDP is packet oriented. The packet sent by the sender's UDP to the application is delivered to the IP layer after the header is added. Without splitting or merging, the boundary of these packets is retained. Therefore, the application needs to select the appropriate packet size.
Although UDP is an unreliable protocol, it is an ideal protocol for information delivery. For example, report the stock market on the screen, and display aviation information on the screen. UDP is also used to modify the route table in the route Information Protocol RIP (Routing Information Protocol. In these applications, if a message is lost, another new message will be replaced in a few seconds. UDP is widely used in multimedia applications. For example, RealAudio software developed by Progressive Networks is a software that transfers pre-recorded or live music to the client in real time over the Internet, the RealAudio audio-on-demand protocol used by the software is the protocol running on UDP, and most Internet telephone software products also run on UDP.
Comparison
The main difference between UDP and TCP is that they differ in how to implement reliable information transmission.
UDP
The TCP protocol includes a special transmission guarantee mechanism. When the data receiver receives the message from the sender, it will automatically send a confirmation message to the sender; the sender continues to transmit other information only after receiving the confirmation message. Otherwise, the sender waits until the confirmation message is received. Unlike TCP, UDP does not provide a data transmission guarantee mechanism. If a data packet is lost during transmission from the sender to the receiver, the Protocol itself cannot detect or prompt. Therefore, UDP is often called an unreliable transmission protocol.
Compared with the TCP protocol, another difference between the UDP protocol is how to receive burst data packets. Unlike TCP, UDP does not guarantee the order in which data is sent and received. In fact, this out-of-order nature of UDP is rarely seen. Generally, it can only happen when the network is very crowded.