Home > Backend Development > PHP Tutorial > Three-way handshake and four-way dissolution process of TCP connection. What is TCP three-way handshake? TCP uses three-way handshake. TCP three-way handshake points.

Three-way handshake and four-way dissolution process of TCP connection. What is TCP three-way handshake? TCP uses three-way handshake. TCP three-way handshake points.

WBOY
Release: 2016-07-29 08:53:13
Original
1099 people have browsed it

In the process of transmitting data using a TCP connection, the client and server need to go through a three-way handshake to establish a connection and a four-way handshake to disconnect.

The details are shown in the figure below

tcp三次握手,tcp/ip三次握手,tcp协议三次握手,tcp三次握手图解,tcp的三次握手过程,tcp三次握手及原理,简述tcp的三次握手,tcp ip协议三次握手,tcp三次握手实验,tcp三次握手的原理,tcp三次握手机制,tcp为什么三次握手,什么是tcp三次握手,tcp采用三次握手,tcp三次握手分

The above figure describes the detailed process of TCP connection from establishment to disconnection. The specific message details will be discussed below.

During the TCP three-way handshake to establish a connection, the client first sends a SYN=1, Sequence=p request packet to the server.

If the server agrees to grant the link to the client, it sends a response packet of ACK=p+1, SYN=1, Sequence=q.

Finally, after the client receives the response packet from the server, it will also send a response packet to the server. The specific content is ACK=q+1, SYN=0, Sequence=p+1.

tcp三次握手,tcp/ip三次握手,tcp协议三次握手,tcp三次握手图解,tcp的三次握手过程,tcp三次握手及原理,简述tcp的三次握手,tcp ip协议三次握手,tcp三次握手实验,tcp三次握手的原理,tcp三次握手机制,tcp为什么三次握手,什么是tcp三次握手,tcp采用三次握手,tcp三次握手分

For TCP disconnection, four handshakes are required. Why not three handshakes? The specific reasons are:

When the server receives the SYN connection request message from the client, it can directly send the SYN+ACK message . The ACK message is used for response, and the SYN message is used for synchronization. But when closing the connection, when the server receives the FIN message, it is likely that the SOCKET will not be closed immediately, so it can only reply with an ACK message first, telling the client, "I received the FIN message you sent." Only when all the messages on my server side have been sent can I send the FIN message, so it cannot be sent together. Therefore, a four-step handshake is required.

The process of disconnection is initiated by the client first. First, the client will send a disconnection request packet with FIN=1 and Sequence=m.

After receiving the request, the server will send a confirmation packet

ACK=m+1, Sequence=n.

At this time, the unilateral connection between the client and the server has been disconnected, and the client will no longer send data packets to the server. The server can still send data to the client. If the server does not need to send data to the client after sending s data packets, it can send a disconnect request to the client at this time.

FIN=1, Sequence=m+s, ACK=m+1.

After the client receives the server’s disconnect request, it will send a confirmation packet.

Sequence=m+1,ACK=m+s+1;

Note that after the client sends the last ACK packet, it will still wait for 2MSL (maximum segment survival time), because the packet may will be lost. The client waits for 2MSL because it is worried that the server does not receive the ACK packet and resends the FIN request.

tcp三次握手,tcp/ip三次握手,tcp协议三次握手,tcp三次握手图解,tcp的三次握手过程,tcp三次握手及原理,简述tcp的三次握手,tcp ip协议三次握手,tcp三次握手实验,tcp三次握手的原理,tcp三次握手机制,tcp为什么三次握手,什么是tcp三次握手,tcp采用三次握手,tcp三次握手分

The above introduces the three-way handshake and four-way dissolution process of TCP connection, including the content of TCP connection and three-way handshake. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template