Get the App
SLTechnology News&Howtos  ›  Network Security  › 

A brief introduction to the working principle of three-way handshake and four-time closing of TCP

Shulou Source: shulou.com Published: 2022-06-01 08:30:53 10月02日 Update

Three-way handshake:

Client A relaxes a connection request message to server B, B sends back a confirmation message after receiving it, A sends a confirmation message after receiving it, and B formally establishes the connection after receiving it. Why does client A need to send another confirmation message later? This is to prevent the last invalid connection request message sent by A from being sent to B suddenly, when B needs to send back a confirmation message, but A knows that this is an invalid connection request message. it does not send a confirmation message, and B does not wait for a period of time without receiving the confirmation, thus saving the resources of server B.

Shut down four times:

Why does it take four times for TCP to shut down? Because TCP connection communication is a two-way process, including client A sending data to server B, and server B sending data to client A. Client A sends disconnection message, server B sends back confirmation message after receiving, A no longer sends data after receiving, but it is only in a semi-closed state at this time, server B can still send data; when B sends disconnection message after sending data, A sends back confirmation message after receiving, and B really completes the release of TCP connection after receiving this confirmation message.

Tags: Messages services customers clients data this is bidirectional just time status network resources process previous communication principle work Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Shulou Tech Info Apple Microsoft MariaDB