When two computers on any given network want to communicate using TCP, they do so by performing the three-way handshake. This process is very similar to a phone conversation. When someone wants to talk to someone, he or she picks up the phone and dial the number, the recipient picks up the ringing phone not knowing who the caller is and says “Hello?”, the original caller then introduces himself by saying “Hi, this is John Kennedy!” In response to this, the receiver will often acknowledge the caller by saying “Oh, hi John!” At this point, both people have enough data for the conversation to continue as normal.
Computers work the same way. When two machines need to communicate, they go through a similar process. The original computer connects to the second computer by transmitting a SYN packet to a specified port number.
If the other computer is alive, it will respond with an SYN/ACK. When the first computer receives the SYN/ACK, it responds with an ACK packet. After that, the two machines can communicate normally. In the phone example above, the first dialer is like sending the SYN packet. The recipient picking up the phone and saying “Hello?” is like the SYN/ACK packet and the first caller introducing himself is like the ACK packet.