TCP connection synchronization is done through the use of the three-way handshake process. This process is used to establish a connection between two devices over a network using the TCP protocol. The three steps in this process are:
1. SYN: The initiating device sends a synchronization (SYN) packet to the receiving device. This packet contains a randomly generated sequence number that identifies the data that will be sent in the connection.
1. SYN-ACK: The receiving device responds with a SYN-ACK packet that acknowledges the SYN packet and includes its own randomly generated sequence number.
1. ACK: Finally, the initiating device sends an acknowledgement (ACK) packet that confirms the connection between the two devices. This packet contains the next sequence number that the sender expects to receive from the receiver.
Once the three-way handshake is complete, the TCP connection is established, and data can be transferred between the two devices. The sequence numbers are then used to ensure that data is sent and received in the correct order and that packets are not lost or duplicated during transmission.