Sobes.tech
Middle

How does a TCP connection get established?

sobes.tech AI

Answer from AI

The TCP connection establishment, also known as the "three-way handshake," consists of the following steps:

  1. SYN (Synchronize): The client sends a segment to the server with the SYN flag, indicating the intention to establish a connection. This segment also contains the client's initial sequence number (ISN).

  2. SYN-ACK (Synchronize-Acknowledge): Upon receiving the SYN, the server responds with a segment with SYN and ACK flags. The server's SYN flag indicates its readiness to accept the connection, and the ACK flag confirms receipt of the client's SYN. This segment also contains the server's ISN and an ACK for the client's ISN (+1).

  3. ACK (Acknowledgement): After receiving the SYN-ACK from the server, the client sends a segment with the ACK flag, confirming receipt of the SYN-ACK. This segment contains an ACK for the server's ISN (+1). After these three segments are exchanged successfully, the connection is established, and the parties can start exchanging data.