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"
It's the start of another school year. China ...
As more and more enterprises begin to realize the...
[[388835]] The COVID-19 pandemic has driven deman...
According to foreign media reports, Lockheed Mart...
[[349454]] 5G will fundamentally change the way o...
As an Internet user, you have more or less heard ...
[51CTO.com original article] Expert introduction:...
We had so much trouble getting security back to n...
RAKsmart has launched this month's promotion,...
The 2022 Winter Olympics will allow everyone to e...
[[387356]] For the development of each generation...
Carriers are expanding their growing list of free...
The new round of technological changes continues ...
Hello everyone, I am Xiaozaojun. [[329660]] When ...
According to the website of the Ministry of Indus...