TCP Connection Establishment or Three Way Handshake – How it is done

Please meet two internet workhorses called TCP/IP and UDP. Pretty much all the data packets that travel the Internet use either one of these two protocols
UDP stands for User datagram protocol; e.g. DHCP uses UDP on ports 67 and 68.
TCP is a connection oriented protocol, unlike UDP which is “connectionless” . Basically it means that a connection MUST be established between the two hosts or between the client and the server before any data packets get transferred between the hosts.
Also when the transfer is completed both hosts disconnect. Internet gurus use the analogy of a phone connection when referring to TCP (there is clearly a beginning and an end) and a post office mail delivery when referring to UDP (the mail will arrive, god knows when, and it gets there eventually although the mail piece may get lost once in a while)


This connection follows a 3 way Handshake sequence:
1) SYN – Host1/client – Sends the 1st segment called the SYN segment. The client specifies which port it wants to use to communicate to the other host or server. The segment has a sequence number. Let’s call it SEQ = X

2) SYN ACK – The HOST2/server, after receiving the 1st segment SYN, replies back with an acknowledgement segment. This reply has a sequence number. Let’s call it: SEQ = X+1. It also sends its unique segment. Let’s call it Y
3) ACK – HOST1/Client after receiving the acknowledgement replies with its own ACK segment stating the next ACK should be Y+1 so ACK= Y + 1
At this point the data transfer can begin between the two hosts
So, remember these 3 steps in the TCP handshaking process::

STEPS Who initiates?

1. SYN (from host1 or client)
2. SYN-ACK (from host2 or server)
3. ACK from host1 or client)

Watch this you tube video by “osischool” that has a grafical representation of this explanation and is quite simple and easy to understand:

This is another explanation of the 3 way handshake done by another blogger:


Finally here is a longer and good explanation on TCP/IP and UDP


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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: