Before the sending device and the receiving device start the exchange of data both device need to be synchronized during the TCP initialization process, the sending device and the receiving device exchange a few control packet for synchronization purpose this exchange is known as three way handshake.
Machine 1 want to initiate a connection with machine 2 so machine 1 sends segment with SYN (Synchronize sequence number) this segment will inform the machine 2 that machine 1 would like to start communication with machine 2 and informs machine 2 what sequence it will start its segment with (sequence numbers are mainly used to keep data in order)
Machine 2 will respond to machine 1 with Acknowledgement (ACK) and SYN bits set now machine 2’s ACK segment does two things.
1) It acknowledges machine 1’s SYN segment.
2) It inform machine 1 what sequence number it will start it’s data with.
Finally machine 1 acknowledges machine 2 initial sequence number and it’s ACK signal and then machine 1 will start the actual data transfer.