Sobes.tech
Middle

How does the TCP handshake occur?

sobes.tech AI

Answer from AI

TCP handshake is the process of establishing a connection between a client and a server using the TCP protocol. It consists of three steps (3-way handshake):

  1. SYN: The client sends a segment with the SYN flag to the server to initiate the connection and specify the initial sequence number.
  2. SYN-ACK: The server responds with a segment with SYN and ACK flags, acknowledging receipt of the SYN and sending its initial sequence number.
  3. ACK: The client sends a segment with the ACK flag, confirming receipt of the SYN-ACK.

After this, the connection is considered established, and data can be exchanged.

Example:

  • Client → Server: SYN seq=100
  • Server → Client: SYN seq=300, ACK ack=101
  • Client → Server: ACK ack=301

This mechanism ensures synchronization of sequence numbers and readiness of both parties for data transfer.