The TCP 3-Way Handshake: How the Internet Says ‘Hello’

MOHIT WAGISHMOHIT WAGISH
2 min read

Every time you visit a website, your computer and the server start a little conversation to ensure a smooth and reliable connection. This conversation is called the TCP 3-Way Handshake — and it's the backbone of how reliable data travels across the internet.


What is TCP?

TCP (Transmission Control Protocol) is one of the main protocols in the internet protocol suite. It's designed to provide reliable, ordered, and error-checked delivery of data between applications.


What is the TCP 3-Way Handshake?

It's the initial setup process between a client and server before any data is exchanged. Think of it as a polite “hello” followed by a firm “we’re ready” from both sides.

The 3 Steps:

  1. SYN (Synchronize)
    Client sends a message to the server saying:
    “Hey, I want to start a conversation. Here's my sequence number!”

  2. SYN-ACK (Synchronize-Acknowledge)
    Server replies:
    “Got your message! Here's my own sequence number and I'm acknowledging yours.”

  3. ACK (Acknowledge)
    Client responds:
    “Cool, let’s begin.”
    Now the connection is established, and data transfer can begin!


Sequence Numbers and ACKs

  • Each device sends a sequence number to track the data sent.

  • ACKs (Acknowledgments) confirm which packets were received.

  • If something is lost, TCP resends it — this makes TCP reliable (unlike UDP, which just sends and forgets).


Why It Matters

  • Ensures both devices are ready and synchronized before sending data

  • Enables reliable and ordered delivery

  • Prevents loss and duplication of data

  • Forms the foundation of secure communication like HTTPS


TCP vs UDP (Quick Comparison)

FeatureTCPUDP
ConnectionConnection-oriented (3-way handshake)Connectionless (no handshake)
ReliabilityYes (retries, ACKs)❌ No
SpeedSlower (due to overhead)Faster
Use CaseWeb browsing, emails, file transferStreaming, gaming, VoIP

0
Subscribe to my newsletter

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

Written by

MOHIT WAGISH
MOHIT WAGISH