The requester (often called the customer) sends a SYN segment (SYN 1) that indicates the port of the server to which the client intends to connect, and the initial order number (ISN).
The server sends back a SYN segment (SYN 1) that contains the server's initial order number (ISN) as the answer. Also, set the confirmation number to customer's ISN plus 1 to confirm the customer's SYN message segment (ACK is also 1).
The customer must set the confirmation number to the server's ISN plus 1 to confirm the SYN message segment of the server (ACK 1), which notifies the destination host that both parties have completed the connection setup.
The three-time handshake protocol can accomplish two important functions: it ensures that the connection is ready for transmission and unifies the initial sequence number for both parties. The initial sequence number is the transmission sequence number during the handshake and is confirmed: when one side sends its SYN for the connection, it selects an initial sequence number for the connection, and each segment includes the Sequence number field and the confirmation Number field, which allows the two machines to negotiate the sequence number of their respective data streams using only three handshake messages. In general, isn varies over time, so each connection will have a different isn.
Three-time handshake to establish a TCP connection