In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
What is the UDP protocol, I believe that many inexperienced people do not know what to do about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
What is UDP?
UDP, the abbreviation of User Datagram Protocol, is a kind of user Datagram protocol, also known as user Datagram protocol. Unlike TCP, which is a connection-oriented protocol, UDP is a simple Datagram-oriented transport layer protocol. The initiation and acceptance of UDP do not need to be connected, and only need to be sent to the corresponding port for listening and acceptance. There is no need for two clients to connect.
Because of its high speed, UDP is suitable for online video media, telephone video chat, television broadcasting, and multiplayer online games.
There are five reasons why UDP transmission is unreliable:
As soon as the data sent to the network is sent, it does not retain the backup data.
At the data level of UDP, just send or receive data without saving, backing up and resending the data, and so on.
UDP only adds multiplexing and data verification to the header of the IP Datagram.
The sender produces the data, the receiver grabs the data from the network, and the timing of sending and grabbing does not want to wait, which may cause the data sent by the client to be not accepted by the server. In fact, there is no standard client and server in UDP.
UDP has simple structure, no parity, high speed, easy to lose packets and can be broadcast.
What is the difference between TCP and UDP?
The TCP protocol has a connection, which means that the client and server of the TCP must establish a connection through a three-way handshake before starting to transmit the actual data, and end the connection after the session ends. And UDP is connectionless.
The TCP protocol ensures that the data is sent in order, arrives in order, and provides timeout retransmission to ensure reliability, but UDP does not guarantee the arrival in order, even if the sequence is sent in sequence, it does not guarantee that it will be delivered in sequence.
The TCP protocol requires a lot of resources, 20 bytes for the TCP header (not optional) and only 8 bytes for the UDP header field.
TCP has flow control and congestion control, but UDP does not. Network congestion will not affect the sending rate of the sender.
TCP is an one-to-one connection, while UDP can support one-to-one, many-to-many, one-to-many communications.
TCP is for byte stream service, and UDP is for message service.
The TCP protocol has no data boundaries, and UDP does. Therefore, TCP is prone to the phenomenon of sticking packets. Packets are sent separately in UDP, and they are integrated again only when they arrive, with clear boundaries to determine which packets have been received.
FAQ: does QQ use TCP or UDP?
The communication protocol adopted by QQ is mainly UDP, supplemented by TCP protocol. QQ is not entirely based on UDP implementation, for example, when using QQ for activities such as file transfer, TCP will be used as a guarantee of reliable transfer.
As the design capacity of QQ server is sea-level applications, a server has to accommodate more than one hundred thousand concurrent connections at the same time, so the server can only use UDP protocol to communicate with the client to ensure this kind of super-large-scale service.
The message transmission between QQ clients also adopts the UDP mode, because the domestic network environment is very complex, and many users use the way to share a line to the Internet through the proxy server. in these complex cases, the probability that the clients can establish an TCP connection with each other is small, which seriously affects the efficiency of transmitting information. The UDP package can penetrate most proxy servers, so QQ chooses UDP as the main communication protocol between customers.
Using UDP protocol, through the server transfer mode. As we all know, UDP is an unreliable protocol, it just sends, no matter whether the other party receives it or not, but its transmission is very efficient. However, as a chat software, how can we use such an unreliable way to transmit messages? Therefore, Tencent uses the upper layer protocol to ensure reliable transmission: if the client sends a message using the UDP protocol, and the server receives the packet, it needs to use the UDP protocol to send back an answer packet. This ensures that the message can be transmitted without omission. The reason why it happens when the client clearly sees the "message sending failure" but the other party receives the message is because the message sent by the client has been received and forwarded successfully by the server, but the client does not receive the reply packet from the server due to network reasons.
The reason for the application of UDP at that time, the most essential advantage of UDP is the use of bandwidth. All this has to return to the state of the network from 1999 to 2003, when the network was characterized by narrow access bandwidth and severe jitter. The so-called jitter may be in many aspects, such as sudden increase in delay, or it may be due to changes in the routing level that suddenly lead to routing black holes, and so on. Because of congestion control, ensuring order and other reasons, the utilization of bandwidth in this network state is very low. Moreover, due to network jitter, the heartbeat of the application layer times out. After the application layer actively disconnects the socket, the TCP needs a three-way handshake to re-establish the link. Once frequent small jitter occurs, the bandwidth utilization will be lower. The time spent waiting for four waves will also take up valuable resources on the server.
To sum up, when the network is poor to a certain extent, the advantage of TCP will become a disadvantage.
After reading the above, have you mastered what is the method of UDP protocol? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.