UDP protocol for network protocols

Source: Internet
Author: User

UDP is a simple datagram-oriented transport layer protocol. Each output operation of a process generates a UDP datagram and assembles it into an IP datagram to be sent, this is different from the protocol for traffic-oriented. For example, TCP, all data generated by the application may be unrelated to a single IP datagram that is actually sent (it is segmented mainly at the transport layer, therefore, it will not be affected by IP fragmentation ).

UDP checksum

As for the UDP checksum, pay attention to the difference here. UDP checks both the header and the data part, while the IP header checksum only verifies the IP Address Header, along with TCP, TCP checksum is also used to verify both the header and data. In addition, UDP checksum is optional, whereas TCP is required.

Unreliable Protocol

UDP is an unreliable protocol without timeout and retransmission. When UDP data is encapsulated in IP datagram transmission, if it is lost, an ICMP error message is sent to the source host, if the UDP datagram sending end does not enable the UDP checksum, and the receiving end calculates the checksum and has errors, the UDP datagram will be discarded and the ICMP error message will not be sent.

Path MTU discovery

You can modify the Traceroute program to determine the path MTU. What we need to do is to send the group and set the IP header as not sharded. The length of the first group sent is equal to that of the egress MTU. Each time an error message cannot be sharded By ICMP is received, the Group length is reduced, so that the new ICMP non-sharding error message returns a smaller MTU, each time it is transmitted with a smaller MTU value, so that a smaller MTU value can be found.

With the path MTU discovery mechanism, applications can make full use of larger MTU to send packets.

Maximum UDP Length

Theoretically, the maximum length of an IP datagram is 65535 bytes. Therefore, in theory, the maximum length of a UDP datagram is 65507 (65535-20-8) bytes. However, the length provided by most implementations is smaller than the maximum value. There are generally two restrictions (for example, see P120 ):

1. Applications may be restricted by their program interfaces. Some API implementations may limit the maximum length of UDP datagram. In addition, most systems now provide UDP datagram with a read/write capacity of more than 8192 bytes by default.

2. restricted by the implementation of the TCP/IP kernel, some implementation features may exist, so that the IP datagram length is less than 65535 bytes.

Datagram Truncation

It is precisely because of the limit on the maximum UDP datagram (generally less than 65507 due to the two factors above) that a datagram larger than this limit will be truncated, resulting in data loss, there will be no notification of data loss, which is another embodiment of the unreliable transmission of UDP protocol. TCP does not have any information boundary, and there is no limit on the maximum TCP packet segment in the TCP header, therefore, TCP transmits data based on the length required by the application for read Operations (theoretically, a large amount of data can be sent at a time, but considering the transmission performance of the network, it is best not to transmit too much data at a time. Of course, when the MSS value is exceeded, segments are generated, so no data truncation occurs.

ICMP Origin Site suppression Error

When the data processing speed of a host or router in a system cannot keep up with the data receiving speed, this error may occur because the IP cache of the receiving host is full, to send an ICMP source station to suppress the error message, please note that it is "possible ".

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.