TCP/IP Protocol Learning Five (UDP protocol)

Source: Internet
Author: User

UDP belongs to the transport layer together with the TCP mentioned earlier.

UDP differs from TCP in that it is a non-connection-oriented protocol, that is, when both parties communicate with each other, they do not need to establish a connection beforehand. So the UDP header saves a lot of fields, and the UDP header is only 8 bytes. The UDP header consists of the following:


The UDP header contains only the source port and destination port, plus the datagram length and checksum. Here say this check and how to calculate, in fact, the TCP checksum is the same calculation. Before the calculation, you need to add a 12-byte pseudo-header, which consists of a pseudo-header and a packet of UDP packets as follows:


Here's how to calculate, you can see the pseudo-header contains some fields of the IP header. The goal is to have UDP two check that the data has reached its destination correctly.
What is the use of this checksum? UDP inspection and is an end-to-end inspection and. It is computed by the sender and then verified by the receiving end. The purpose is to discover any changes that occur between the UDP header and the data between the sending end and the receiving end. If the send-side checksum is different from the receiving end, the packet is discarded.

We see in the front Ethernet frame structure, the Ethernet frame in addition to the Ethernet header, the data area IP datagram maximum is 1500, that is, the maximum Transmission Unit Ethernet mtu=1500 bytes. The IP header size is 20 bytes and the UDP header is 8 bytes, so the maximum UDP data that can be transmitted is 1472 bytes. The bytes transferred exceed this range to be fragmented, and at the time of the Shard, the header (UDP header) of the transport layer only appears in the first Shard, and the other shards contain only the IP header. The following shows the Shard situation when transmitting 1501 bytes packets:


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.