Skip to main content

TCP 3 Way Handshake



To establish a connection, TCP uses a three-way handshake. Before a client attempts to connect with a server, the server must first bind to and listen at a port to open it up for connections: this is called a passive open. Once the passive open is established, a client may initiate an active open. To establish a connection, the three-way (or 3-step) handshake occurs:
1.          SYN: The active open is performed by the client sending a SYN to the server. The client      
                  sets the segment's sequence number to a random value A.
2.          SYN-ACK: In response, the server replies with a SYN-ACK. The acknowledgment number 
                  is set to one more than the received sequence number i.e. A+1, and the sequence 
                  number that the server chooses for the packet is another random number, B.
3.            ACK: Finally, the client sends an ACK back to the server. The sequence number is set to 
                  the received acknowledgement value i.e. A+1, and the acknowledgement number is 
                  set to one more than the received sequence number i.e. B+1.

At this point, both the client and server have received an acknowledgment of the connection. The steps 1, 2 establish the connection parameter (sequence number) for one direction and it is acknowledged. The steps 2, 3 establish the connection parameter (sequence number) for the other direction and it is acknowledged. With these, a full-duplex communication is established.

Comments

Popular posts from this blog

Active and Passive FTP

Active and Passive FTP The FTP server may support Active or Passive connections, or both.  In an Active FTP connection, the client opens a port and listens and the server actively connects to it.  In a Passive FTP connection, the server opens a port and listens (passively) and the client connects to it.  You must grant Auto FTP Manager Access to the Internet and to choose the right type of FTP Connection Mode. Most FTP client programs select passive connection mode by default because server administrators prefer it as a safety measure.  Firewalls generally block connections that are "initiated" from the outside.  Using passive mode, the FTP client is "reaching out" to the server to make the connection.  The firewall will allow these outgoing connections, meaning that no special adjustments to firewall settings are required. If you are connecting to the FTP server using Active mode of connection you must set your firewa...