What is TCP?

What is TCP?

TCP is like a reliable postal service for the internet. When you send data (like a message, file, or video) over the internet, TCP ensures it arrives safely, in order, and without errors.


How TCP Works (Step-by-Step)

  1. Connection Setup (3-Way Handshake)
  • Before sending data, your computer and the server “shake hands” to establish a connection:
    1. SYN – Your computer says, “Hey, can we talk?”
    2. SYN-ACK – The server replies, “Sure, let’s talk!”
    3. ACK – Your computer says, “Great, here’s my first message!”
  • Now, the connection is open!
  1. Data Transfer (Reliable & Ordered)
  • Our data is split into small packets (like enveloped letters).
  • Each packet has a sequence number so the receiver can put them back in order.
  • If a packet gets lost, TCP retransmits it (like resending a lost letter).
  1. Flow Control (No Overwhelming)
  • If the receiver is slow, TCP slows down the sender to avoid flooding it.
  • Think of it like adjusting water flow from a tap to prevent overflow.
  1. Error Checking (No Corruption)
  • Each packet has a checksum (like a fingerprint) to detect errors.
  • If data is corrupted, then TCP asks for it again.
  1. Connection Termination (Polite Goodbye)
  • When done, both sides agree to close the connection properly:
    1. FIN – “I’m done sending.”
    2. ACK – “Got it, I’m done too.”
    3. Connection closed!

Real-Life Example (Sending a Letter via TCP)

  1. Handshake → You call your friend to confirm they’re ready to receive letters.
  2. Sending → You mail numbered pages (Packet 1, Packet 2…).
  3. Reliability → If a page is lost, your friend asks you to resend it.
  4. Order → Your friend arranges pages in order before reading.
  5. Closing → You both agree the conversation is over.

Why TCP is Important

Reliable – No lost/corrupted data.
Ordered – Data arrives in the right sequence.
Error-checked – No mistakes in transmission.
Flow-controlled – Prevents network congestion.

Where is TCP Used?

  • Web browsing (HTTP/HTTPS)
  • Email (SMTP)
  • File transfers (FTP)
  • Streaming (but sometimes uses UDP for speed)

TCP vs. UDP (Quick Comparison)

FeatureTCP (Reliable)UDP (Fast)
ConnectionYes (Handshake)No (Just sends)
ReliabilityGuaranteedNo guarantees
OrderIn-order deliveryMay arrive out of order
SpeedSlower (more checks)Faster (no checks)
Use CasesWeb, Email, FilesGaming, Live Video

Final Summary

TCP is the trustworthy mailman of the internet—it makes sure your data arrives correctly, in order, and without loss. It’s perfect for things where accuracy matters more than speed.

Farheen Hashmi
http://farheenblogger.com

2 Comments

Connection Establishment – Learning Hub

[…] two devices (like your computer and a web server) want to communicate over *TCP, they first perform a *3-way handshake to establish a reliable connection. Think of it like two […]

pmsfpnlixl

gkqjsjztsveyfnsunffmhrkjqqijtd

Leave a Reply