Characteristics of UDP protocol and its header format

齐天大圣
Release: 2020-12-21 11:27:23
Original
3938 people have browsed it

Features of UDP

The UDP protocol is very simple, and it adds almost no functions to the IP layer. Let’s take a look at some features of the UDP protocol:

  • UDP is connectionless and delivers best effort. It will not notify you in advance before sending data. It just sends it and does not care whether you can receive it or not.

  • UDP is message-oriented. Whatever content the application gives it, it encapsulates a header in front of the content and forwards it to the IP layer below. It doesn’t matter whether the content is large or small, I will send whatever you give me. For its brainless operation, the application process needs to choose the appropriate size. To prevent overly large data packets from being split at the IP layer, marketing efficiency will be improved.

  • UDP supports one-to-one, one-to-many and many-to-many communication. Judging from the fact that TCP only supports point-to-point communication, UDP seems to be doing a pretty good job.

  • The UDP header is simple and is a fixed 8 bytes.

Based on the above characteristics of UDP, we can guess some of its application scenarios:

  • Suitable for environments with relatively good networks and good for packet loss Not sensitive.

  • Scenarios that require broadcasting, such as the DHCP protocol, which requires broadcasting, so it uses the UDP protocol.

  • In scenarios with high transmission efficiency and fast speed, such as live video broadcast, it is generally insignificant that a few frames of live video broadcast are lost.

UDP header format

As mentioned above, the UDP header is a fixed 8 bytes. Compared with TCP, its header overhead is very small.

Characteristics of UDP protocol and its header format

  • Source port number, occupies 2 bytes

  • Destination port number, occupies 2 bytes

  • Header length, occupies 2 bytes

  • Checksum, occupies 2 bytes

If the destination host receives a UDP packet with an illegal port number, it will discard the packet and then send an ICMP error message "Port Unreachable" to the source host. The traceroute command uses this feature to obtain path information between two hosts.

The verification method of UDP is somewhat special. When verifying, it needs to add a 12-byte pseudo header to the header at zero time. The pseudo header is used only for verification and is discarded after verification is completed. In addition, unlike IP datagrams which only check the header, it will check the header and data part.

Related recommendations: "linux video tutorial"

The above is the detailed content of Characteristics of UDP protocol and its header format. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
udp
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template