TCP Working: 3-Way Handshake & Reliable Communication

Hey Everyone,
Have you ever stopped on this how your message is sent to your friend living in a far country in order without messing any data?
Answer: TCP
Let’s break it down step by step — no jargon overload, just simple.
Why Do We Even Need Rules to Send Data?
Imagine sending a very long message to your friend by pieces of paper in the air.
Some pieces might:
Get lost
Arrive late
Arrive out of order
Reach the wrong person
That’s exactly what happens on the internet without rules.
So we need a system that ensures:
Data reaches the right place
Nothing is lost
Everything arrives in the correct order.
That system is TCP.
What Is TCP?

TCP (Transmission Control Protocol) is a transport-layer protocol that provides:
Reliablity
Mantain order of the packets
Error Checking
Guarantee Delivery
What Is the TCP 3-Way Handshake?
TCP does not send data immediately.
First, it establishes a connection using something called the 3-Way Handshake.

The 3-Way Handshake is TCP’s way of saying:
“Are you ready to talk?”
“Yes, I’m ready.”
“Cool, let’s start.”
It ensures both sides are ready before data transfer begins.
Step-by-Step: TCP 3-Way Handshake
Let’s say Client wants to talk to Server.

Step 1: SYN (Client → Server)
It is like the client is asking the server
A Server are you ready. I want to create a connection
Step 2:SYN ACK(Server→Client)
The server responds to the request
Yes i got your request. I am ready
Step 3:ACK(Client)
The client sends an ACK.
Meaning:
Acknowledged. Let’s Proceed with the connection.
🎉 Connection established!
Now, both sides trust each other and data transfer can begin.
How Data Transfer Works in TCP
Once connected, TCP sends data in segments.
Each segment has:
Sequence number
Data
Error-checking info
What Happens When Data Is Sent?
Client sends data with a sequence number
Server receives it
Server sends an ACK
Client sends the next chunk
This continues until all data is delivered.
How TCP ensures reliability, order, and correctness
TCP ensures reliability by waiting for an acknowledgment signal indicating that the packet is successfully transferred.
Even if packets arrive out of order, TCP reassembles them correctly
If data gets corrupted, TCP detects it and requests retransmission
No ACK?
👉 TCP assumes data is lost.
What If a Packet Is Lost?
Suppose 3 packets are going
1 packet transferred ✅
2nd packet fail ❌
3rd packet successfully transferred ✅
TCP will know that, so it will again send the 2nd packet.
This is why TCP is reliable but slower than UDP.
How a TCP Connection Is Closed
When communication is done, TCP closes the connection gracefully.
Connection Termination (FIN & ACK)
Client sends FIN → “I’m done.”
Server sends ACK
Server sends FIN
Client sends ACK
Connection closed safely
No half-open or broken connections.
TCP Connection Lifecycle
Establish → 3-Way Handshake
Transfer → Reliable data exchange
Close → FIN & ACK
Where TCP Is Used in Real Life

File Transfer
Messaging
YouTube Live Streaming 😮
Youtube Streaming How? In your earlier blogs you told that for live streaming UDP is used over TCP.
Yes Yes, I know but Youtube live uses TCP as if someone wants to go back 10-20sec.
But how can it handle speed?
Youtube gives a 40 second delay in live streaming that why it works fine with TCP.
And now, you know What is 3 way handshake in TCP.
If you have any doubt or want to connect, feel free to drop a comment — I’d be happy to help.
Thanks for reading, and see you in the next blog!
Peace ✌️ and Happy Learning!




