Connection Control: Three-way Handshake

TCP is a connection oriented protocol that is responsible to create, maintain and terminate the connection as a separate three phase of connection.

It establishes a virtual path between source and destination and all the segments follows this path till it reaches the destination.

Three-way Handshaking:

The algorithm used to establish and terminate the connection in TCP is called three way handshaking. It involves the exchange of three messages between client and server.

Following are the three steps involved in connection establishment:

The client sends the SYN packet to the server:

When the client wants to connect to server, it sets the SYN flags and sends the message to the server. This message is like initiation of the communication and thus contains information which need to be shared between client and server before the connection is established.

Some of the common info are:

  • Sequence number
  • Window size and
  • Maximum segment size(MSS)

For example, if the window size is 2000 bits, and maximum segment size is 200 then maximum of 10 data segments need to be transmitted.

The server responds with the SYN and ACK to the client:

This message has both the SYN and ACK flag set, that is ACK for the last message(SYN) it received from the client and also SYN flag set for initiating the connection from its end. The ack number is 1 more than the received sequence number.

Even this message wont carry any data, just the same info as above that is sequence number, window size and MSS.

The client sends the ACK to the server: This is the last message for 3-way handshake to complete and its and ACK to to the last message from the server side with SYN flag set.

Any packet with no data bytes, just the flag set is called as phony bytes.

3-Way Handshake Process

untitled image

3-Way handshake PCAP

untitled image

Categories: Networking

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: