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?
Megalayer has launched its September event, offer...
In recent years, the Internet of Things (IoT) has...
Keepalive is a high-availability component that i...
Ever since 5G has entered the homes of ordinary p...
[[188757]] Company Introduction Karamay is the on...
Since the beginning of this year, the digital cur...
Foreign media reported that in 2020, global inves...
Song Ge has been serializing gRPC with his friend...
EtherNetservers is a foreign hosting company esta...
In the two years since 5G was put into commercial...
Machine Learning Machine learning is a field of e...
Regarding network knowledge, I mainly talk about ...
4G has just entered a stable development period, ...
Today, at the MWCS 2021 media analyst pre-communi...
VMISS has once again released a 30% discount code...