TCP Working: 3-Way Handshake & Reliable Communication
TCP Explained Simply: Why It Exists and How Reliable Communication Works
When we send data over the internet, it feels instant and smooth.
But behind the scenes, sending data is actually risky.
Data travels through:
multiple networks
unknown paths
crowded routes
Without rules, things can easily break.
This is exactly why TCP exists.
What Happens If Data Is Sent Without Rules?
Imagine shouting instructions across a busy street:
words may be missed
order may change
listener may hear half the message
Now imagine sending important data like:
passwords
payment details
website content
If even one part is missing or out of order, the result is wrong.
The internet needed a system that says:
“Send data carefully, in order, and confirm it reaches safely.”
That system is TCP.
What Is TCP and Why Is It Needed?
TCP (Transmission Control Protocol) is a communication rule that ensures data is:
delivered correctly
delivered completely
delivered in the right order
TCP is used when accuracy matters more than speed.
Without TCP:
websites would load broken
files would corrupt
APIs would fail randomly
Problems TCP Is Designed to Solve
TCP exists to solve these real problems:
Data loss – some data may disappear on the way
Out-of-order delivery – data may arrive in the wrong order
Duplicate data – same data may arrive twice
No confirmation – sender doesn’t know if data arrived
Uncontrolled speed – sender may overwhelm receiver
TCP handles all of this automatically.
Introducing the TCP 3-Way Handshake
Before sending actual data, TCP first establishes a connection.
This process is called the 3-Way Handshake.
Think of it like starting a phone call.
3-Way Handshake Explained Using a Conversation Analogy
Imagine two people:
Client (your browser) and Server (website).
Step 1: SYN – “Can we talk?”
Client says:
“Hi, can I start a connection?”
This message is called SYN (synchronize).
Step 2: SYN-ACK – “Yes, I’m ready”
Server replies:
“Yes, I’m ready. Can you hear me?”
This reply is SYN-ACK.
Step 3: ACK – “Yes, let’s start”
Client responds:
“Yes, I hear you. Let’s talk.”
This message is ACK (acknowledgement).
After these three steps:
✅ Both sides are ready
✅ Connection is established
✅ Data transfer can begin
Step-by-Step Summary of SYN, SYN-ACK, ACK
SYN → Client requests connection
SYN-ACK → Server accepts and responds
ACK → Client confirms
Only after this does real data move.
How Data Transfer Works in TCP (Simple View)
Once the connection is established:
Data is broken into small pieces
Each piece is numbered
Pieces are sent one by one
These numbers help TCP:
track missing data
reorder data correctly
avoid duplicates
You don’t see this — TCP handles it silently.
Sequence Numbers and Acknowledgements (High Level)
Think of data like numbered pages of a book.
Page 1
Page 2
Page 3
The receiver says:
“I received page 1 and 2. Send page 3 next.”
This is how TCP:
knows what arrived
knows what is missing
How TCP Ensures Reliability
TCP ensures reliability in three main ways:
1. Acknowledgements
Every chunk of data sent must be acknowledged.
If no response is received, TCP assumes it was lost.
2. Retransmission
If data is missing:
TCP resends only the missing part
not everything again
3. Flow Control
TCP makes sure:
sender doesn’t send too fast
receiver is not overloaded
This keeps communication stable.
How TCP Maintains Order and Correctness
Because every piece of data is numbered:
TCP can reorder data correctly
TCP removes duplicates
TCP ensures full message reconstruction
Even if data arrives like:
3 → 1 → 2
TCP rearranges it to:
1 → 2 → 3
How a TCP Connection Is Closed
Just like starting a connection, closing it is also controlled.
TCP does not just disappear.
Connection Termination Using FIN and ACK
Closing a TCP connection is like ending a polite conversation.
Step 1: FIN – “I’m done sending data”
One side says:
“I have no more data to send.”
This message is FIN.
Step 2: ACK – “I understand”
The other side replies:
“Okay, I received that.”
Step 3: FIN from the other side
The second side also says:
“I’m done too.”
Step 4: Final ACK
Final confirmation is sent.
Connection is now cleanly closed.
Why TCP Feels Invisible but Is Extremely Important
You don’t see TCP.
You don’t manage TCP.
But you depend on it daily.
Browsing websites
Using APIs
Sending emails
Downloading files
All of this works because TCP quietly does its job.

