<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[TCP Working]]></title><description><![CDATA[TCP Working]]></description><link>https://abhi-tcp-working.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Thu, 17 Sep 2026 08:53:16 GMT</lastBuildDate><atom:link href="https://abhi-tcp-working.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[TCP Working: 3-Way Handshake & Reliable Communication]]></title><description><![CDATA[Imagine sending an important message to someone…but you don’t know:

if they received it

if they understood it

or if parts of the message got lost


That’s exactly what would happen on the internet without rules.
This is why TCP exists.
Let’s under...]]></description><link>https://abhi-tcp-working.hashnode.dev/tcp-working-3-way-handshake-and-reliable-communication</link><guid isPermaLink="true">https://abhi-tcp-working.hashnode.dev/tcp-working-3-way-handshake-and-reliable-communication</guid><category><![CDATA[computer networking]]></category><category><![CDATA[TCP]]></category><category><![CDATA[#3-way handshaking]]></category><dc:creator><![CDATA[Abhishek Yadav]]></dc:creator><pubDate>Sun, 01 Feb 2026 15:37:06 GMT</pubDate><content:encoded><![CDATA[<p>Imagine sending an important message to someone…<br />but you don’t know:</p>
<ul>
<li><p>if they received it</p>
</li>
<li><p>if they understood it</p>
</li>
<li><p>or if parts of the message got lost</p>
</li>
</ul>
<p>That’s exactly what would happen on the internet <strong>without rules</strong>.</p>
<p>This is why <strong>TCP exists</strong>.</p>
<p>Let’s understand TCP step by step slowly, clearly, and in a human way.</p>
<hr />
<h2 id="heading-what-is-tcp-and-why-is-it-needed">What Is TCP and Why Is It Needed?</h2>
<p><strong>TCP (Transmission Control Protocol)</strong> is a communication rule that makes sure data:</p>
<ul>
<li><p>reaches the correct destination</p>
</li>
<li><p>arrives in the correct order</p>
</li>
<li><p>is complete and accurate</p>
</li>
</ul>
<p>The internet is unreliable by nature:</p>
<ul>
<li><p>Packets can get lost</p>
</li>
<li><p>Packets can arrive out of order</p>
</li>
<li><p>Networks can be congested</p>
</li>
</ul>
<p>TCP exists to <strong>handle this chaos</strong> and make communication reliable.</p>
<hr />
<h2 id="heading-what-problems-is-tcp-designed-to-solve">What Problems Is TCP Designed to Solve?</h2>
<p>If data were sent without TCP:</p>
<ul>
<li><p>Messages could be incomplete</p>
</li>
<li><p>Files could be corrupted</p>
</li>
<li><p>Websites could break randomly</p>
</li>
</ul>
<p>TCP solves:</p>
<ul>
<li><p><strong>Packet loss</strong></p>
</li>
<li><p><strong>Out-of-order delivery</strong></p>
</li>
<li><p><strong>Duplicate packets</strong></p>
</li>
<li><p><strong>Data corruption</strong></p>
</li>
</ul>
<p>In short:</p>
<blockquote>
<p>TCP makes the internet <em>trustworthy</em>.</p>
</blockquote>
<hr />
<h2 id="heading-before-data-is-sent-the-need-for-a-handshake">Before Data Is Sent: The Need for a Handshake</h2>
<p>TCP does <strong>not</strong> send data immediately.</p>
<p>First, it makes sure:</p>
<ul>
<li><p>The sender is ready</p>
</li>
<li><p>The receiver is ready</p>
</li>
<li><p>Both agree to communicate</p>
</li>
</ul>
<p>This process is called the <strong>TCP 3-Way Handshake</strong>.</p>
<hr />
<h2 id="heading-what-is-the-tcp-3-way-handshake">What Is the TCP 3-Way Handshake?</h2>
<p>The <strong>3-Way Handshake</strong> is how a TCP connection is established between a <strong>client</strong> and a <strong>server</strong>.</p>
<p>Think of it like starting a phone call .</p>
<hr />
<h2 id="heading-3-way-handshake-simple-conversation-analogy">3-Way Handshake: Simple Conversation Analogy</h2>
<p>Imagine this conversation:</p>
<ol>
<li><p><strong>Client:</strong> “Hey, can you hear me?”</p>
</li>
<li><p><strong>Server:</strong> “Yes, I can hear you. Can you hear me?”</p>
</li>
<li><p><strong>Client:</strong> “Yes, let’s talk.”</p>
</li>
</ol>
<p>Only after this do they start talking.</p>
<p>That’s the TCP handshake.</p>
<hr />
<h2 id="heading-step-by-step-syn-syn-ack-ack">Step-by-Step: SYN, SYN-ACK, ACK</h2>
<p>Let’s break it down clearly.</p>
<hr />
<h3 id="heading-step-1-syn-client-server">Step 1: SYN (Client → Server)</h3>
<ul>
<li><p>Client sends a <strong>SYN</strong> message</p>
</li>
<li><p>Meaning:</p>
<blockquote>
<p>“I want to start a connection.”</p>
</blockquote>
</li>
</ul>
<p>This message also includes a <strong>sequence number</strong>, which helps track data later.</p>
<hr />
<h3 id="heading-step-2-syn-ack-server-client">Step 2: SYN-ACK (Server → Client)</h3>
<ul>
<li><p>Server replies with <strong>SYN-ACK</strong></p>
</li>
<li><p>Meaning:</p>
<blockquote>
<p>“I received your request, and I’m ready.”</p>
</blockquote>
</li>
</ul>
<p>Server also sends its own sequence number.</p>
<hr />
<h3 id="heading-step-3-ack-client-server">Step 3: ACK (Client → Server)</h3>
<ul>
<li><p>Client sends <strong>ACK</strong></p>
</li>
<li><p>Meaning:</p>
<blockquote>
<p>“I received your response. Connection established.”</p>
</blockquote>
</li>
</ul>
<p>Connection is now open.  </p>
<p><img src="https://intronetworks.cs.luc.edu/1/html/_images/tcp_ladder_states.png" alt="12 TCP Transport — An Introduction to Computer Networks" /></p>
<hr />
<h2 id="heading-what-happens-after-the-handshake">What Happens After the Handshake?</h2>
<p>Only <strong>after the handshake</strong> does TCP start sending actual data.</p>
<p>Now comes <strong>data transfer</strong>.</p>
<hr />
<h2 id="heading-how-data-transfer-works-in-tcp-high-level">How Data Transfer Works in TCP (High Level)</h2>
<p>Data is:</p>
<ul>
<li><p>Broken into small packets</p>
</li>
<li><p>Each packet gets a <strong>sequence number</strong></p>
</li>
<li><p>Receiver sends <strong>ACKs</strong> for received packets</p>
</li>
</ul>
<p>Think of it like numbered pages in a book :</p>
<ul>
<li><p>Page 1</p>
</li>
<li><p>Page 2</p>
</li>
<li><p>Page 3</p>
</li>
</ul>
<p>If page 2 is missing, the receiver asks for it again.</p>
<hr />
<h2 id="heading-how-tcp-ensures-reliability">How TCP Ensures Reliability</h2>
<p>TCP uses three main ideas:</p>
<ol>
<li><h3 id="heading-sequence-numbers">Sequence Numbers</h3>
</li>
</ol>
<ul>
<li><p>Every packet has a number</p>
</li>
<li><p>Helps arrange data in the correct order</p>
</li>
</ul>
<ol start="2">
<li><h3 id="heading-acknowledgements-acks">Acknowledgements (ACKs)</h3>
</li>
</ol>
<ul>
<li><p>Receiver confirms which packets were received</p>
</li>
<li><p>Sender knows what arrived successfully</p>
</li>
</ul>
<ol start="3">
<li><h3 id="heading-retransmission">Retransmission</h3>
</li>
</ol>
<ul>
<li><p>If ACK is not received</p>
</li>
<li><p>TCP resends the missing packet</p>
</li>
</ul>
<p>This is why file downloads don’t get corrupted.</p>
<hr />
<h2 id="heading-how-tcp-handles-packet-loss">How TCP Handles Packet Loss</h2>
<p>Example:</p>
<ul>
<li><p>Packet 3 gets lost</p>
</li>
<li><p>Receiver gets packets 1, 2, and 4</p>
</li>
<li><p>Receiver notices packet 3 is missing</p>
</li>
<li><p>Sender retransmits packet 3</p>
</li>
</ul>
<p>User never notices this TCP handles it silently.</p>
<hr />
<h2 id="heading-how-tcp-ensures-correctness">How TCP Ensures Correctness</h2>
<p>TCP also checks:</p>
<ul>
<li><p>Data integrity using checksums</p>
</li>
<li><p>Duplicate packets</p>
</li>
<li><p>Corrupted data</p>
</li>
</ul>
<p>If something is wrong packet is discarded and resent.</p>
<hr />
<h2 id="heading-how-a-tcp-connection-is-closed">How a TCP Connection Is Closed</h2>
<p>Just like starting a connection, closing it is also <strong>controlled</strong>.</p>
<p>TCP uses:</p>
<ul>
<li><p><strong>FIN</strong></p>
</li>
<li><p><strong>ACK</strong></p>
</li>
</ul>
<h3 id="heading-simple-analogy">Simple analogy:</h3>
<blockquote>
<p>“I’m done talking.”<br />“Okay, I acknowledge.”<br />“I’m also done.”<br />“Acknowledged.”</p>
</blockquote>
<p>Only then is the connection fully closed.</p>
<p>This prevents data from being cut off midway.</p>
<hr />
<h2 id="heading-tcp-connection-lifecycle-big-picture">TCP Connection Lifecycle (Big Picture)</h2>
<ol>
<li><p>Connection established (3-way handshake)</p>
</li>
<li><p>Data transfer</p>
</li>
<li><p>Reliability checks</p>
</li>
<li><p>Connection termination</p>
<p> <img src="https://static.afteracademy.com/images/what-is-a-tcp-3-way-handshake-process-three-way-handshaking-establishing-connection-6a724e77ba96e241.jpg" alt="What is a TCP 3-way handshake process?" /></p>
</li>
</ol>
<p>This full cycle ensures <strong>safe and predictable communication</strong>.</p>
<hr />
<h2 id="heading-why-tcp-is-so-important-for-the-web">Why TCP Is So Important for the Web</h2>
<p>TCP is used in:</p>
<ul>
<li><p>Website loading (HTTP/HTTPS)</p>
</li>
<li><p>Emails</p>
</li>
<li><p>File transfers</p>
</li>
<li><p>Online payments</p>
</li>
<li><p>APIs</p>
</li>
</ul>
<p>If TCP didn’t exist, the modern internet wouldn’t work.</p>
]]></content:encoded></item></channel></rss>