Why tcp connect termination need 4-way-handshake?

后端 未结 5 1251
感动是毒
感动是毒 2021-02-03 23:30

When connection sets up, there is:

Client ------SYN-----> Server

Client <---ACK/SYN---- Server ----①

Client ------ACK-----> Ser

5条回答
  •  臣服心动
    2021-02-04 00:24

    • In the Three-Way Handshake (connection setup) : The server must acknowledge (ACK) the client's SYN and the server must also send its own SYN containing the initial sequence number for the data that the server will send on the connection.
      That why the server sends its SYN and the ACK of the client's SYN in a single segment.
    • In connection Termination : it takes four segments to terminate a connection since a FIN and an ACK are required in each direction.
      (2) means that The received FIN (first segment) is acknowledged (ACK) by TCP
      (3) means that sometime later the application that received the end-of-file will close its socket. This causes its TCP to send a FIN.
      And then the last segment will mean that The TCP on the system that receives this final FIN acknowledges (ACK) the FIN.

提交回复
热议问题