Please talk about the TCP model, state transition

TCP model, state transition

TCP four-layer model:
application layer,
network layer,
data link layer,
physical layer

State transition The state transition of the
server: The
server is in listen after it is opened, waiting for the client's connection request. When the server receives the connection request syn from the client, the server enters the synreceive state, and responds with syn and ack to indicate that the connection is accepted, and when the server receives ack again. The server believes that the connection has been established and entered the establish state. When the server receives fin=1, it indicates that the client wants to close the connection. At this time, the server enters the close_wait state. At this time, the server is not receiving data, but can continue to send data. When the server data is sent, the server The fin will be sent and counted into the lask_ack state. In the lask_ack state, after the server receives the fin and ack from the client, the server closes the connection and is in the close state.

State transition of the
client : After the client sends syn = 1, it will be in the synsned state. After receiving the syn and ack from the server, the client will return an acknowledgement to send an ack. After sending it, it will enter the establish state. The client sends fin=1 to actively close the connection and will be in the fin_wait_1 state.
In this state:
1. The server will reply with an ack indicating that the server can still send data. At this time, the client will enter the fin_wait_2 state, indicating that it is waiting for the server to close the connection.
2. After receiving fin =1 from the server, the client sends an ack and enters the closing state.
3. After receiving the fin+ack from the server, the client will send ack into the time_wait state, and after 2MSL, it will be completely closed.

Guess you like

Origin blog.csdn.net/aaaqqq1234/article/details/108308234