To establish a connection, TCP uses a 3-way handshake. Before a client attempts to connect with a server, the server must first bind to a port to open it up for connections: this is called a passive open. Once the passive open is established then a client may initiate an active open. To establish a connection, the 3-way (or 3-step) handshake occurs:
The active open is performed by sending a SYN to the server.
In response, the server replies with a SYN-ACK.
Finally the client sends an ACK back to the server.
At this point, both the client and server have received an acknowledgement of the connection.
when we want to connect to server for communication we need to establish a connection between server and client. The procedure used for this is called 3-way handshake...this is described as follows
1. Initillay the server is ready to accept the incoming connection by binding to local port. This is called passive open.
2. The client now can connect to server by sending SYN J segment to server. The server responds with SYN J+1 and ACK K
3. At the end the client sends ACK K+1 to server..
At this stage we say that client and server are connected