We know that the communication modes between client A and server B can be divided into: full-duplex, half-duplex, and simplex:
TCP is full-duplex.
How TCP works Next, I will show you how TCP works. From the previous knowledge, we learned that TCP has three handshakes (previous reference: HTTP also has long and short connections? HTTP long connection vs short connection). Schematic diagram of TCP's three-way handshake: The specific meaning can be understood as follows: 1. A handshake The client wants to send a packet to the server with the SYN flag set to 1 and the initial sequence number X, which is encapsulated in the sequence number field in the packet header. The client enters the SYN_SEND state and waits for confirmation from the server. 2. Second handshake The server sends back an ACK (acknowledgement packet), setting both the SYN and ACK flags to 1, and modifying the sequence number to X+1. At the same time, it also sends a packet, a SYN packet, with a sequence number (seq = Y), that is, a SYN + ACK packet. At this point the server enters the SYN_RECV state. 3. The third handshake The client receives the (ACK+SYN) packet sent by the server, and the SYN flag is 0. The ACK flag is 1. At the same time, add 1 to the sequence number field of the ACK packet sent by the server and put it in the packet, and send it to the server, that is, ACK=Y+1. Popular explanation: Do you still find it difficult to understand? Let me give you an example. First, we assume that A and B are the two parties communicating this time. Sending a message represents a handshake.
Then we started a pleasant chat. Is a two-way handshake possible? So let's explore whether two handshakes are possible.
But what about client A? There is no guarantee that it will receive the information sent by server B. What if client A does not receive the information sent by the server? The client will think that the communication between us has not been established. Such a communication process is obviously unsuccessful. If there are a large number of such cases, Server B will crash. It seems that only two handshakes are not enough to complete the working principle of TCP communication. If two times is not enough, what about four times? Is a four-way handshake OK? According to the TCP communication principle above, we know that after the three-way handshake, client A and server B can both confirm the messages they sent before, and each can receive and send the messages to the other party successfully. According to the above conclusion, whether you shake hands four times or five times, it is futile, because after the "three handshakes", everything that needs to be done has been done. in conclusion TCP's three-way handshake is a classic, and the communication protocols on computers are also based on TCP's three-way handshake and four-way handshake. Because the direct communication between computer applications is based on the HTTP protocol, and HTTP is actually implemented by the TCP protocol, which has been mentioned before.
We can see that after three handshakes, we can draw the following conclusions:
|
>>: What should you do if you forget the wireless router backend login address?
We live in an era of rapid development of IT tech...
There is a legend circulating on the Internet abo...
China Huaxin Post and Telecommunications Economic...
Technically, the various WAN technologies vary du...
At the Apple conference this morning, the most ex...
Wireless networks have improved dramatically over...
The story of 2017 has come to an end. On the surf...
With the continuous development of the fifth gene...
Edge computing use cases are broad and its early ...
In the public opinion field, operators are critic...
Megalayer promotional VPS packages are being rest...
1. Distribution of the global optical communicati...
South Korean telecom operator SK Telecom recently...
There is a place that gathers the most energetic ...
SD-WAN is more than just an alternative to Multip...