Meaning and functions of UDP protocol

Source: Internet
Author: User

UDP is at the top layer of the IP protocol, which should be clear to everyone. Therefore, the complex protocol structure of the network constructs all aspects of the network. Today we will introduce the basic content of the UDP protocol. The UDP Protocol is short for the User data Protocol. It is mainly used to support network applications that need to transmit data between computers. Network applications in customer/Server mode, including network video conferencing systems, must use UDP protocol. UDP has been used for many years since its publication. Although its initial Glory has been concealed by some similar protocols, even today, UDP is still a very practical and feasible network transport layer protocol.

UDP is a connectionless Datagram Protocol. UDP simply sends data to the port of the target host, and the data can be transmitted without notifying the target party, the two sides no longer jointly maintain a connection.

1. UDP protocol Overview

Like the well-known TCP transmission control protocol, UDP is directly located at the top layer of the IP Internet protocol. According to OSI Open System Interconnection) reference model, both UDP and TCP are transport layer protocols.

The main function of UDP protocol is to compress network data traffic into a datagram. A typical datagram is the unit of transmission of binary data. The first eight bytes of each datagram are used to contain header information, and the remaining bytes are used to contain specific transmitted data. The UDP header consists of four fields, each of which occupies 2 bytes, including the source port number, destination port number, datagram length, and check value.

The UDP protocol uses the port number to reserve its own data transmission channels for different applications. The UDP and TCP Protocols use this mechanism to support sending and receiving data simultaneously for multiple applications at the same time. The data sender can be a client or server) sends UDP data through the source port, while the data receiver receives data through the target port. Some network applications can only use static ports reserved or registered for them in advance, while other network applications can use unregistered dynamic ports. Because the UDP header uses two bytes to store the port number, the valid range of the port number is from 0 to 65535. Generally, a port number larger than 49151 represents a dynamic port. The length of a datagram refers to the total number of bytes, including the header and data. Because the header length is fixed, this field is mainly used to calculate the variable-length data part, also known as the data load ). The maximum length of a datagram varies depending on the operating environment. From Theory

The maximum length of a datagram, including the header, is 65535 bytes. However, in some practical applications, the size of data packets is often limited, and sometimes reduced to 8192 bytes.

UDP uses the checksum value in the header to ensure data security. The verification value is calculated by the Data sender using a special algorithm. After it is passed to the receiver, it needs to be re-calculated. If a data packet is tampered with by a third party during transmission or damaged due to line noise or other reasons, the sent data does not match the verification calculation value of the receiver. Therefore, the UDP protocol can detect whether an error occurs. In fact, the validation function is optional in UDP protocol. If you disable it, the system performance can be improved. This is different from the TCP protocol, which requires a verification value.

2. Differences between UDP and TCP

The main difference between UDP and TCP is that they differ in how to implement reliable information transmission. The TCP protocol includes a special transmission guarantee mechanism. When the data receiver receives the message from the sender, it will automatically send a confirmation message to the sender; the sender continues to transmit other information only after receiving the confirmation message. Otherwise, the sender waits until the confirmation message is received.

Unlike TCP, UDP does not provide a data transmission guarantee mechanism. If a data packet is lost during transmission from the sender to the receiver, the Protocol itself cannot detect or prompt. Therefore, UDP is usually called an unreliable transmission protocol. Compared with the TCP protocol, another difference between the UDP protocol is how to receive burst data packets. Unlike TCP, UDP does not guarantee the order in which data is sent and received.

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.