Read the original speed -TCP / IP (UDP datagram maximum length)

Chapter 11 UDP: User Datagram Protocol

The maximum length of 11.10 UDP datagram

In theory the maximum length, the IP datagram is 65,535 bytes, which is composed of a header portion IP (Figure 3 - 1) 16-bit Total Length field restricted. Removal of the 20-byte IP header and a UDP header of 8 bytes portion, the maximum length of the user data in the UDP datagram is 65,507 bytes. However, most implementations provided by the length of the maximum value is smaller than this.

We will encounter two limiting factors. First, the application program may be limited by its interface. socket API provides a function for calling the application to set the length of the transmission and reception buffer. For UDP socket, is directly related to the length of the length of this application can read or write maximum UDP datagram. Most systems are now provided by default UDP datagram may be greater than 8192 to read and write byte (the default value is used because 8192 is the number of NFS write data user defaults).

The second limitation comes from the kernel implementation of TCP / IP. There may be implemented properties (or error), so that the IP datagram length is less than 65,535 bytes.

The authors used sock program to a different UDP datagram length were tested. Loopback maximum length IP datagram interface under SunOS 4.1.3 is 32,767 bytes. It is larger than the value of the error will occur. However, from BSD / 3 8 6 the case where SunOS 4.1.3, S un can receive a maximum length IP datagram is 32,786 bytes (i.e., 32758 bytes of user data). In Solaris 2.2 using the loopback interface, send and receive a maximum length IP datagram is 65,535 bytes. From Solaris 2.2 to AIX 3.2.2, the maximum length of an IP datagram is 65,535 bytes can be transmitted. Obviously, this restriction and implementation of the source and destination concerned.

We mentioned in Section 3.2, the host must be able to receive it requires a minimum of 576-byte IP datagram. In designing many UDP application, whose application is limited to 512 bytes or less, so less than this limit. For example, we see Section 0.4, the route information transmitting each protocol data packets is always less than 512 bytes of data. We will be in other UDP applications such as DNS (Chapter 1 4), TFTP (Chapter 1 5), BOOTP (Chapter 16), and SNMP encountered this restriction (Chapter 25) in.

Truncate data packets
because the IP can transmit or receive data packets of a specific length data does not mean that the receiving application can read length. Thus, UDP programming interface allows applications to specify the maximum number of bytes per return. If the received data packet length is greater than the length of the application can handle, then what would happen? Unfortunately, the answer to this question depends on the programming interface and implementation.

A typical version B erkeley datagram socket API truncation, and discards any redundant data. When the application to know, and the version (truncated version of 4.3BSD Reno and later can notify the application datagrams) related.

SVR 4 at socket API (including Solaris 2.x) is not truncated data packet. Excess data returned in a later reading. It does not notify multiple applications from a single UDP datagram reading operation. TLI API does not discard the data. Instead, it returns an indication that more data can be obtained, while the latter application has a read will return the rest of the datagram.

In discussing TCP, we find that it provides a continuous stream of bytes for the application, and no boundaries. TCP application program to read the length required to transmit data, therefore, at this interface, data loss does not occur.

Released 1489 original articles · won praise 1394 · Views 120,000 +

Guess you like

Origin blog.csdn.net/weixin_42528266/article/details/104698722