UDP: user-defined primitive refers to the function of basic logic elements designed by users themselves, that is, UDP can be used to define their own characteristic basic logic element modules for simulation and establish corresponding primitive libraries, and perform simulation. Its structural module is similar to the general module, starting with the keyword of primitive and ending with the keyword of endprimitive.
The Internet protocol suite supports a connectionless transmission protocol, which is called User Datagram Protocol (UDP, User Datagram Protocol). UDP provides a way for applications to send encapsulated IP packets without establishing a connection. RFC 768 describes UDP.
The transport layer of the Internet has two main protocols that complement each other. The connectionless is UDP, which has little to do except for sending data packets to applications and allowing them to construct their own protocols at the required level. Connection-oriented is TCP, and the protocol does almost everything.
UDP is the abbreviation of User Datagram Protocol, and the Chinese name is User Datagram Protocol. It is a connectionless transport layer protocol in the OSI (Open System Interconnection) reference model, which provides simple and unreliable transaction-oriented information transmission services. , IETF RFC 768 is the official specification of UDP. The protocol number of UDP in IP packets is 17.
The UDP protocol is used to process data packets like the TCP protocol. In the OSI model, both are located at the transport layer, at the upper layer of the IP protocol. UDP has the disadvantages of not providing packet grouping, assembly and sorting of data packets. That is to say, after a packet is sent, it is impossible to know whether it arrived safely and completely. UDP is used to support network applications that need to transfer data between computers. Many network applications in the client/server mode including the network video conference system need to use the UDP protocol. The UDP protocol has been in use for many years since its inception. Although its initial glory has been obscured by some similar protocols, even today UDP is still a very practical and feasible network transport layer protocol.
Many applications only support UDP, such as multimedia data streams, and do not generate any additional data, even if they know that there are damaged packets, they will not be retransmitted. When emphasizing transmission performance rather than transmission integrity, such as: audio and multimedia applications, UDP is the best choice. UDP is also a good choice when the data transmission time is so short that the previous connection process becomes the main body of the entire flow.
content
UDP is a connectionless transport layer protocol in the OSI reference model. It is mainly used in transmissions that do not require the arrival of the packet sequence. The inspection and sequencing of the packet transmission sequence are completed by the application layer, which provides a simple and unreliable transaction-oriented information transmission service. . The UDP protocol is basically the interface between the IP protocol and the upper layer protocol. The UDP protocol is suitable for multiple applications running on the same device on the same port.
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. Commonly used UDP port numbers are: 53 (DNS), 69 (TFTP), 161 (SNMP), the use of UDP protocols include: TFTP, SNMP, NFS, DNS, BOOTP.
UDP packets do not have reliability guarantees, sequence guarantees and flow control fields, etc., and their reliability is poor. However, because there are few control options of the UDP protocol, the delay during data transmission is small, and the data transmission efficiency is high. It is suitable for applications with low reliability requirements, or applications that can ensure reliability, such as DNS, TFTP, SNMP Wait.
Features
In order to identify multiple destination addresses on a given host, and allow multiple applications to work on the same host and independently send and receive data packets, the user datagram protocol UDP is designed.
UDP uses the underlying Internet protocol to transmit messages, providing unreliable connectionless packet transmission services like IP. It does not provide functions such as message arrival confirmation, sequencing, and flow control.
UDP Helper can realize the relay forwarding of the broadcast message of the specified UDP port, that is, convert the broadcast message of the specified UDP port into a unicast message and send it to the specified server to play the role of relay.
Message format editing
In the UDP protocol hierarchy model, UDP is located above the IP layer. The application accesses the UDP layer and then uses the IP layer to transmit datagrams. The data portion of the IP packet is the UDP datagram. The header of the IP layer specifies the source and destination host addresses, while the header of the UDP layer specifies the source and destination ports on the host. The UDP transmission segment (segment) is composed of 8 bytes of header and payload field.
The UDP header consists of 4 fields, each of which occupies 2 bytes, including the source port number, destination port number, datagram length, and check value.
The following will briefly introduce the UDP datagram format, please refer to RFC 768 for details.
The port number
The UDP protocol uses the port number to reserve its own data transmission channel for different applications. UDP
The TCP protocol uses this mechanism to support multiple applications sending and receiving data at the same time. The data sending party (which can be a client or server) sends UDP packets through the source port, while the data receiving party receives data through the target port. Some network applications can only use static ports reserved or registered in advance for them; while others 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. In general, port numbers greater than 49151 represent dynamic ports. There are two ways to specify the UDP port number: the management agency specifies the port and the dynamic binding method.
length
The length of the datagram refers to the total number of bytes including the header and the data part. Because the length of the header is fixed, this field is mainly used to calculate the variable-length data portion (also known as data payload). The maximum length of the datagram varies depending on the operating environment. In theory, the maximum length of a datagram including the header is 65535 bytes. However, some practical applications tend to limit the size of the datagram, sometimes reducing it to 8192 bytes.
Check value
The UDP protocol uses the check value in the header to ensure data security. The check value is first calculated by the data sender through a special algorithm, and needs to be recalculated after being passed to the receiver. If a datagram is tampered with by a third party during transmission or damaged due to line noise, the verification calculation values of the sender and receiver will not match, so the UDP protocol can detect whether there is an error. This is different from the TCP protocol, which requires a check value.
Many link layer protocols provide error checking, including the popular Ethernet protocol. Maybe you want to know why UDP also provides checking and verification. The reason is that protocols below the link layer may not provide error detection in some channels between the source and the terminal. Although UDP provides error detection, when an error is detected, UDP does not perform error correction, but simply throws away the damaged message segment or provides a warning message to the application.
UDP is a connectionless protocol. The source and terminal do not establish a connection before transmitting data. When it wants to transmit, it simply grabs the data from the application and throws it on the network as quickly as possible. At the sending end, the speed at which UDP transmits data is limited only by the speed at which the application generates data, the capabilities of the computer, and the transmission bandwidth; at the receiving end, UDP places each message segment in the queue, and the application removes it from the queue each time. Read a message segment.
Since the transmission data does not establish a connection, there is no need to maintain the connection status, including the sending and receiving status, etc., so a server can simultaneously transmit the same message to multiple clients.
The header of the UDP packet is very short, only 8 bytes, and the extra overhead of UDP is very small compared to the 20 byte packet of TCP.
Throughput is not regulated by the congestion control algorithm, and is only limited by the rate at which the application software generates data, the transmission bandwidth, and the performance of the source and end hosts.
UDP is message-oriented. The UDP sent by the sender to the application is delivered to the IP layer after adding the header. Neither split nor merge, but keep the boundaries of these packets, therefore, the application needs to choose the appropriate packet size.
Although UDP is an unreliable protocol, it is an ideal protocol for distributing information. For example, reporting the stock market on the screen, displaying aviation information, etc. UDP is also used in RIP (Routing Information Protocol) to modify the routing table. In these applications, if a message is lost, another new message will replace it after a few seconds. UDP is widely used in multimedia applications.
The main difference between UDP and TCP protocols is that they differ in how to achieve reliable transmission of information. The TCP protocol contains a special delivery guarantee mechanism. When the data receiver receives the information from the sender, it will automatically send a confirmation message to the sender; the sender will continue to transmit other information only after receiving the confirmation message. Otherwise, it will wait until the confirmation message is received. Unlike TCP, UDP protocol does not provide a guarantee mechanism for data transmission. If the packet loss occurs during the transmission from the sender to the receiver, the protocol itself cannot make any detection or prompt. Therefore, people often refer to the UDP protocol as an unreliable transmission protocol.
TCP is a connection-oriented transmission control protocol, and UDP provides a connectionless datagram service; TCP has high reliability to ensure the correctness of the transmitted data without loss or disorder; UDP does not establish a connection before transmitting data, which is incorrect The datagram is checked and modified without waiting for the other party's response, so there will be packet loss, duplication, and disorder. The application needs to be responsible for all aspects of transmission reliability; UDP has better real-time performance and higher efficiency than the TCP protocol ; UDP segment structure is simpler than TCP segment structure, so the network overhead is also small. The TCP protocol can ensure that the receiving end receives the byte stream sent by the sending end without errors, and provides reliable communication services for application programs. Communication systems that require high reliability often use TCP to transmit data.
Applications
Care must be taken when choosing UDP as the transport protocol. In an environment where network quality is very unsatisfactory, UDP protocol packet loss will be more serious. However, due to the characteristics of UDP: it is not a connection protocol, so it has the advantages of low resource consumption and fast processing speed, so usually audio, video and ordinary data use UDP when transmitting, because they even occasionally lose one or two data The packet will not affect the receiving result too much. For example, the ICQ and QQ we use for chat are the UDP protocols used.
Practical application
In the field of field measurement and control, it is oriented to distributed controllers, monitors, etc., and its application environment is relatively harsh, so it puts forward different requirements for the transmission data, such as real-time, anti-interference, security, etc. Based on this, in field communication, if an application wants to transmit a set of data to another node in the network, the data can be added to the header by the UDP process and then transmitted to the IP process. The UDP protocol saves the establishment and disconnection of the connection. Process! The retransmission check mechanism is cancelled, and a higher communication rate can be achieved.
FPGA Spartan-3A Family 700K Gates 13248 Cells 667MHz 90nm Technology 1.2V 484-Pin FBGA
FPGA Spartan-3A Family 700K Gates 13248 Cells 667MHz 90nm Technology 1.2V 256-Pin FTBGA
FPGA Virtex-II Family 1M Gates 11520 Cells 750MHz 0.15um Technology 1.5V 896-Pin FCBGA
FPGA Virtex-II Family 1M Gates 11520 Cells 750MHz 0.15um Technology 1.5V 256-Pin FBGA
FPGA Virtex-II Family 1M Gates 11520 Cells 820MHz 0.15um Technology 1.5V 256-Pin FBGA
Support