Explain the TCP connection establishment using a three way handshake mechanism.
Connection Establishment
TCP uses a Three way handshaking mechanism to establish a connection between client and server machines. The three steps in three way handshaking mechanism are as follows.
SYN:
The client sends the first segment, a SYN segment, in which only the SYN flag is set. This segment is for synchronization of sequence numbers.
SYN + ACK
The server sends the second segment, a SYN +ACK segment, with 2 flag bits set.
ACK
The client sends the third segment. This is just an ACK segment. It guarantees the completion of three way handshaking.