tcp-ip UDP: User Datagram Protocol

来源:互联网 发布:深圳交通数据采集 编辑:程序博客网 时间:2024/04/19 20:49

The port numbers identify the sending process and the receiving process.

The UDP length field is the length of the UDP header and the UDP data in bytes.The minimum value for this field is 8 bytes. (Sending a UDP datagram with 0 bytes of data is OK.)

UDP Checksum

The UDP checksum covers the UDP header and the UDP data.

Both UDP and TCP include a 12-byte pseudo-header with the UDP datagram (or TCP segment) just for the checksum computation.

In this figure we explicitly show a datagram with an odd length, requiring a pad byte for the checksum computation. Notice that the length of the UDP datagram appears twice in the checksum computation.

If the calculated checksum is 0, it is stored as all one bits (65535), which is equivalent in onescomplement arithmetic. If the transmitted checksum is 0, it indicates that the sender did not compute the checksum.

If the sender did compute a checksum and the receiver detects a checksum error, the UDP datagram is silently discarded. No error message is generated.

A host is required to receive at least a 576-byte IP datagram.Many UDP applications are designed to restrict their application data to 512 bytes or less, to stay below this limit.


0 0
原创粉丝点击