Skip to main content

Command Palette

Search for a command to run...

TCP: How the Internet Talks Reliably

Published
3 min read

Imagine sending an important letter, but there are no rules.

Pages might arrive out of order.
Some pages might never arrive.
The receiver might not even know when the letter is complete.

That’s exactly what would happen on the internet without proper rules.

The internet moves data in tiny pieces, across many networks, through routers it doesn’t control. Things can get lost, delayed, or duplicated. To make communication reliable, the internet needs a system that brings order, trust, and correctness.

That system is TCP.


What is TCP and why it is needed

TCP (Transmission Control Protocol) is a communication protocol that ensures data is delivered:

  • Reliably

  • In the correct order

  • Without corruption

TCP doesn’t care how fast data moves — it cares that data arrives correctly.

Any time correctness matters more than speed, TCP is used.


Problems TCP is designed to solve

Without TCP:

  • Data could arrive out of order

  • Some data could go missing

  • The receiver wouldn’t know what was received

  • The sender wouldn’t know what failed

TCP solves these by:

  • Tracking every piece of data

  • Confirming delivery

  • Resending missing data

  • Maintaining a clear start and end of communication


What is the TCP 3-Way Handshake?

Before sending data, TCP first establishes trust.

This happens through the 3-Way Handshake.

Think of it like starting a phone call:

  1. “Can you hear me?”

  2. “Yes, I can hear you. Can you hear me?”

  3. “Yes, we’re connected.”

Only after this does real conversation begin.


Step-by-step: SYN, SYN-ACK, ACK

1️⃣ SYN — “I want to talk”

The client sends a SYN message:

“I want to start a connection.”

This includes a starting number called a sequence number.


2️⃣ SYN-ACK — “I’m listening”

The server replies with SYN-ACK:

“I heard you, and I’m ready too.”

The server also sends its own sequence number.


3️⃣ ACK — “Let’s talk”

The client sends ACK:

“I acknowledge your response.”

At this point, the connection is established.

Now data can flow safely.


How data transfer works in TCP

Data is broken into small chunks.

Each chunk:

  • Has a sequence number

  • Is tracked carefully

The receiver sends back acknowledgements (ACKs) saying:

“I received everything up to here.”

If something is missing, TCP knows exactly what to resend.


How TCP ensures reliability and order

TCP guarantees:

  • Reliability: Lost data is resent

  • Order: Data is reassembled correctly

  • Correctness: Corrupted data is rejected

If packets arrive out of order, TCP rearranges them.
If packets are lost, TCP retries.

The application doesn’t worry — TCP handles it.


How a TCP connection is closed

When communication is done, the connection must end cleanly.

This uses FIN and ACK messages:

  • One side says: “I’m done sending data”

  • The other acknowledges

  • The same happens in reverse

This ensures:

  • No data is cut off

  • Resources are released properly


Final thought

TCP isn’t fast.
TCP isn’t flashy.

But TCP is trustworthy.

Every website you load, every API you call, every file you download depends on TCP quietly doing its job — making sure the internet doesn’t fall into chaos.

4 views