🤝 The TCP 3-Way Handshake: What It Is and Why It's Important

ABHISHEKABHISHEK
3 min read

When two computers want to talk on the internet — whether it's loading a website, sending a message, or downloading a file — they need a reliable way to start the conversation. That’s where TCP’s 3-Way Handshake comes in. Think of it like two people greeting each other before starting a serious conversation.

Let’s break it down in simple terms. 🧠✨

🛜 What is TCP?

TCP (Transmission Control Protocol) is one of the core protocols of the internet. It makes sure that data sent from one device arrives at another device accurately and in the correct order.

But before the actual data (like a video or webpage) is sent, the two devices need to establish a connection. And they do this using the 3-Way Handshake.

👋 The 3 Steps of the TCP Handshake

Let’s imagine Computer A (Client) wants to connect to Computer B (Server). Here’s how they “shake hands”:

1. SYN (SYNchronize)

  • The client sends a message to the server saying:

    “Hi! I’d like to start a connection. Here's my starting sequence number (let's call it 1000).”

  • This is the SYN message.

2. SYN-ACK (SYNchronize + ACKnowledge)

  • The server replies:

    “Hello! I got your request (acknowledging your sequence number 1000), and I’m ready too. Here's my sequence number (let’s say 3000).”

  • This is the SYN-ACK message — it acknowledges the client and shares its own sequence number.

3. ACK (ACKnowledge)

  • The client replies:

    “Thanks! I got your sequence number 3000. Let’s start the data transfer!”

  • This is the final ACK message.

Connection Established! Both sides now trust each other and can start sending actual data.


🧠 Why is This Important?

The 3-way handshake ensures:

  • Both devices are ready to communicate.

  • No data is lost or sent to the wrong place.

  • The connection is synchronized — both sides know where to start reading the incoming data.

Without it, your messages could get jumbled, lost, or duplicated. Imagine trying to watch a video where every third second is missing — not fun! 😵‍💫

🔐 Bonus: Why Use Sequence Numbers?

Sequence numbers in the handshake help:

  • Keep track of where data starts

  • Rebuild data in the correct order

  • Ensure no missing or duplicate data

Think of it like page numbers in a book. They help you read everything in the right order.

🎨 Visual Analogy

Imagine you're calling a friend:

  1. 📞 You: “Hey, can we talk?”

  2. 📞 Friend: “Yes! I’m here. You ready?”

  3. 📞 You: “Yep, let’s go!”

Now you're both ready for the conversation — just like TCP!

💡 Conclusion

The TCP 3-Way Handshake may sound technical, but it’s simply the internet’s way of saying “Hello” and ensuring a safe and reliable conversation between two devices.

Whether you're building a website, creating an app, or just curious — understanding this process gives you a solid foundation in how the internet works under the hood.

0
Subscribe to my newsletter

Read articles from ABHISHEK directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

ABHISHEK
ABHISHEK