Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Understanding UDP sockets

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

TCP is a convergence-oriented transmission protocol, which requires three handshakes when setting up the connection, four handshakes when disconnecting the connection, and ACK packet confirmation when transmitting data at both ends. Many mechanisms guarantee that the data can arrive accurately and will not be lost or stumbled.

The transmission protocol of UDP long and short convergence does not establish the process of convergence and disconnection, it just complex to throw data into the collection, and does not require ACK packet confirmation.

UDP transmits data as if we are mailing a package. We need to fill in the address of the sender and recipient before mailing it, and then send it to the courier company, but we cannot know whether the package can be delivered accurately or whether it can be damaged. The same is true of the UDP protocol, which sends packets to the collection, and then no matter, if the data is lost or corrupted, the sender will not know and certainly will not be retransmitted.

In that case, TCP should be a more high-quality transport protocol, right?

If you only think about reliability, TCP is really better than UDP. However, UDP is more concise in construction than TCP, and it does not send ACK response messages or assign Seq sequence numbers to packets, so the transmission effectiveness of UDP is sometimes much higher than that of TCP, and the completion of UDP is more complex than TCP in programming.

UDP is not as reliable as TCP, but it does not cause data corruption as frequently as expected. With more emphasis on transmission effectiveness rather than reliability, UDP is a good choice. For example, video communication or audio communication is very appropriate to adopt the UDP protocol; when communicating, data must be transmitted efficiently in order not to have a "stutter" scene, and the user experience becomes more fluent. If you lose a few data packets, the video picture can show "snowflakes" and the audio can contain some noise.

Compared with UDP, the life of TCP lies in stream mastery, which guarantees the accuracy of data transmission.

The initial requirement makes it clear that TCP cannot outpace UDP, but can be close to UDP when sending and receiving certain types of data. For example, the larger the amount of data exchanged each time, the closer the transmission speed of TCP is to UDP.

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.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report