Understanding of TCP three-way handshake and four-way wave

In the computer network class, I specially learned the meaning of the three-way handshake and the four-way wave, but I forgot a little bit, so I went to review some of them and made some records here.

For the three-way handshake, I saw a group of very interesting pictures on the Internet, and put them here.

 


 

In general, the three-way handshake is still to deal with the complex network environment, in order to achieve a smooth connection and not waste network resources.

Three-way handshake:

1. The client needs to connect to the server, first send a request to tell the server that he wants to connect

2. The server receives the request, agrees to the connection, tells the client to agree, and sends back an agreed response

3. The client then responds to the server's agreed response and officially starts the connection

If you say what kind of errors will occur in programming two handshakes,

1. The client wants to connect to the server and initiates a request to the server

2. The server agrees to the connection and sends back an agreed response

If at this time, there is no three-way handshake, and the server's agreed response is lost on the network, the client will think that the server has rejected the request, and the server has been waiting for the data sent by the client.

 Talk about four more waves, and both server and client can offer to disconnect. Why wave hands four times, first of all, because the TCP connection is full-duplex, what is full-duplex, probably means that both the client and the server can transmit data at the same time.

Four waves:

1. When the client wants to disconnect, it first issues a disconnect request

2. When the server receives a request from the client, it first disconnects its own read connection and gives a feedback to the client. The client receives and closes its own write channel.

3. The server sends an acknowledgment, the client closes its own read channel after receiving it, and gives a return

4. The server closes its own write channel after receiving it.

 In fact, it is the first time that the server has contacted the statement of read channel and write channel. I think this may be more detailed, because in this way, one less channel will be closed when the four handshakes are less. , but in practice it is not clear whether the read channel and the write channel are also divided.

The other is the one we learned in class. We

 saw a good example that can explain why the above picture is waving four times instead of three times. This example is not clear at once, and I will add it here when I remember it.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326266492&siteId=291194637