This article is reprinted from the WeChat public account "JS Daily Question", the author is Huihui. Please contact the JS Daily Question public account to reprint this article. 1. Three-way handshakeThree-way handshake actually means that when establishing a TCP connection, the client and server need to send a total of 3 packets. The main function is to confirm whether the receiving and sending capabilities of both parties are normal, and to specify their own initialization sequence numbers to prepare for subsequent reliable transmission. The process is as follows:
The purpose of each of the above handshakes is as follows:
Through the three-way handshake, it can be confirmed that the receiving and sending capabilities of both parties are normal. After that, normal communication can be carried out Why not a two-way handshake? If it is a two-way handshake, the sender can be sure that the information it sends can be received by the other party, and can also be sure that the packet sent by the other party can be received by itself, but the receiver can only be sure that it can receive the packet sent by the other party, but cannot be sure that the packet sent by itself can be received by the other party. In addition, if there are two handshakes, the client may send multiple request messages due to network congestion and other reasons. The delayed requests will establish a connection with the server, wasting a lot of server resources. Two or four wavesTCP terminates a connection, which requires four handshakes The process is as follows:
Four waves reason After receiving the Fin message from the client, the server will not close the connection immediately. Instead, it will send an ACK packet to inform the client that it has received the request to close the connection. Only when all the messages from the server have been sent will it send a FIN message to disconnect. Therefore, four handshakes are required. ConclusionA complete three-way handshake and four waves are shown in the following figure: References https://zhuanlan.zhihu.com/p/53374516 https://segmentfault.com/a/1190000020610336 |
<<: It will take time for 5G to achieve a breakthrough from "1 to N"
With the advent of the big data era, all kinds of...
Hostmem is a Chinese VPS service provider. The tr...
Introduction Simple is beautiful. In the world of...
SSH (Secure Shell) is an end-to-end encrypted net...
5G has unique challenges in not only enabling ser...
If you want fiber-like speeds or high-speed inter...
On the 27th, China Telecom released its first qua...
Nowadays, in such a competitive market as server ...
Why does the front-end need to understand the HTT...
We know the “voice and text messaging” capabiliti...
RAKsmart is a foreign hosting company operated by...
From cross-border e-commerce to new energy vehicl...
Software-defined WAN is a feature-rich technology...
The wonderful opening ceremony of the 2022 Beijin...
It has been nearly a year and a half since the fi...