<?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: 3-Way Handshake]]></title><description><![CDATA[TCP Working: 3-Way Handshake]]></description><link>https://tcp-3wayhandshake.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Mon, 21 Sep 2026 22:27:05 GMT</lastBuildDate><atom:link href="https://tcp-3wayhandshake.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[Why Do We Even Need TCP?
Imagine sending an important message without any rules:

You don’t know if the other person is ready

Messages may arrive out of order

Some messages may never arrive


That’s exactly what would happen on the internet without...]]></description><link>https://tcp-3wayhandshake.hashnode.dev/tcp-working-3-way-handshake-and-reliable-communication</link><guid isPermaLink="true">https://tcp-3wayhandshake.hashnode.dev/tcp-working-3-way-handshake-and-reliable-communication</guid><category><![CDATA[ChaiCode]]></category><category><![CDATA[TCP]]></category><category><![CDATA[TCP Handshake]]></category><category><![CDATA[networking]]></category><dc:creator><![CDATA[Abhimanyu Kumar]]></dc:creator><pubDate>Wed, 28 Jan 2026 08:11:06 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769587763692/32857f50-2efe-4918-95da-6d97180f29d5.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-why-do-we-even-need-tcp">Why Do We Even Need TCP?</h2>
<p>Imagine sending an important message without any rules:</p>
<ul>
<li><p>You don’t know if the other person is ready</p>
</li>
<li><p>Messages may arrive out of order</p>
</li>
<li><p>Some messages may never arrive</p>
</li>
</ul>
<p>That’s exactly what would happen on the internet <strong>without TCP</strong>.</p>
<p>TCP exists to make sure <strong>data reaches the right place, in the right order, without loss</strong>.</p>
<hr />
<h2 id="heading-what-is-tcp">What is TCP?</h2>
<p><strong>TCP (Transmission Control Protocol)</strong> is a <strong>reliable communication protocol</strong> used by the internet to send data safely between two systems.</p>
<p>TCP ensures:</p>
<ul>
<li><p>Data reaches the destination</p>
</li>
<li><p>Data arrives in the correct order</p>
</li>
<li><p>Lost data is resent</p>
</li>
<li><p>Both sides agree before talking</p>
</li>
</ul>
<blockquote>
<p>TCP is like a <strong>registered courier service</strong> with tracking and delivery confirmation.</p>
</blockquote>
<hr />
<h2 id="heading-problems-tcp-is-designed-to-solve">Problems TCP Is Designed to Solve</h2>
<p>If we send data without TCP:</p>
<ul>
<li><p>Data may be lost</p>
</li>
<li><p>Data may arrive out of order</p>
</li>
<li><p>Sender won’t know if data was received</p>
</li>
<li><p>Receiver may get duplicate or corrupted data</p>
</li>
</ul>
<p>TCP solves all of this.</p>
<hr />
<h2 id="heading-what-is-the-tcp-3-way-handshake">What Is the TCP 3-Way Handshake?</h2>
<p>Before any data is sent, TCP performs a <strong>3-step agreement process</strong> called the <strong>3-Way Handshake</strong>.</p>
<p>Purpose:<br />To make sure <strong>both client and server are ready to communicate</strong>.</p>
<p>Simple analogy:</p>
<blockquote>
<p>Like starting a phone call and saying “Hello” before talking.</p>
</blockquote>
<hr />
<h2 id="heading-step-by-step-tcp-3-way-handshake">Step-by-Step: TCP 3-Way Handshake</h2>
<h3 id="heading-step-1-syn-client-server">Step 1: SYN (Client → Server)</h3>
<p>Client says:</p>
<blockquote>
<p>“Hey Server, I want to talk. Are you there?”</p>
</blockquote>
<ul>
<li><p>Client sends a <strong>SYN</strong> packet</p>
</li>
<li><p>Includes an initial sequence number</p>
</li>
</ul>
<hr />
<h3 id="heading-step-2-syn-ack-server-client">Step 2: SYN-ACK (Server → Client)</h3>
<p>Server replies:</p>
<blockquote>
<p>“Yes, I’m here and ready.”</p>
</blockquote>
<ul>
<li><p>Server sends <strong>SYN + ACK</strong></p>
</li>
<li><p>ACK confirms client’s request</p>
</li>
<li><p>SYN is server’s own request to start communication</p>
</li>
</ul>
<hr />
<h3 id="heading-step-3-ack-client-server">Step 3: ACK (Client → Server)</h3>
<p>Client responds:</p>
<blockquote>
<p>“Great! Let’s start.”</p>
</blockquote>
<ul>
<li><p>Client sends <strong>ACK</strong></p>
</li>
<li><p>Connection is now established</p>
</li>
</ul>
<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>
<hr />
<h2 id="heading-what-happens-after-the-handshake">What Happens After the Handshake?</h2>
<p>Once the connection is established:</p>
<ul>
<li><p>Data transfer begins</p>
</li>
<li><p>TCP manages delivery, order, and reliability</p>
</li>
</ul>
<hr />
<h2 id="heading-how-data-transfer-works-in-tcp">How Data Transfer Works in TCP</h2>
<p>TCP breaks data into <strong>small chunks (segments)</strong>.</p>
<p>Each segment has:</p>
<ul>
<li><p><strong>Sequence Number</strong> → position of data</p>
</li>
<li><p><strong>ACK Number</strong> → confirmation of received data</p>
</li>
</ul>
<p>Receiver sends ACKs to confirm:</p>
<blockquote>
<p>“I received data till sequence number X”</p>
</blockquote>
<hr />
<h2 id="heading-how-tcp-ensures-reliability">How TCP Ensures Reliability</h2>
<h3 id="heading-1-acknowledgements-acks">1. Acknowledgements (ACKs)</h3>
<ul>
<li><p>Every received segment is acknowledged</p>
</li>
<li><p>Sender knows exactly what arrived</p>
</li>
</ul>
<hr />
<h3 id="heading-2-sequence-numbers">2. Sequence Numbers</h3>
<ul>
<li><p>Data is reordered if it arrives incorrectly</p>
</li>
<li><p>Prevents jumbled messages</p>
</li>
</ul>
<hr />
<h3 id="heading-3-retransmission">3. Retransmission</h3>
<ul>
<li><p>If ACK is not received → data is resent</p>
</li>
<li><p>Handles packet loss automatically</p>
</li>
</ul>
<hr />
<h3 id="heading-packet-loss-amp-retransmission-flow">Packet Loss &amp; Retransmission Flow</h3>
<p><img src="https://media.geeksforgeeks.org/wp-content/uploads/20220302155907/FastrecoverywithoutSACKdrawio.jpg" alt="Fast Recovery Technique For Loss Recovery in TCP - GeeksforGeeks" class="image--center mx-auto" /></p>
<h2 id="heading-how-tcp-ensures-correctness">How TCP Ensures Correctness</h2>
<p>TCP uses:</p>
<ul>
<li><p>Error checking</p>
</li>
<li><p>Duplicate detection</p>
</li>
<li><p>Controlled data flow</p>
</li>
</ul>
<p>Result:</p>
<blockquote>
<p>Data received = Data sent</p>
</blockquote>
<hr />
<h2 id="heading-how-a-tcp-connection-is-closed">How a TCP Connection Is Closed</h2>
<p>Closing a connection is also <strong>polite and rule-based</strong>.</p>
<h3 id="heading-step-1-fin-one-side-says">Step 1: FIN (One side says)</h3>
<blockquote>
<p>“I’m done sending data.”</p>
</blockquote>
<h3 id="heading-step-2-ack">Step 2: ACK</h3>
<blockquote>
<p>“Okay, I got it.”</p>
</blockquote>
<h3 id="heading-step-3-fin-other-side">Step 3: FIN (Other side)</h3>
<blockquote>
<p>“I’m also done.”</p>
</blockquote>
<h3 id="heading-step-4-ack">Step 4: ACK</h3>
<blockquote>
<p>“Connection closed.”</p>
</blockquote>
<p><img src="https://media.geeksforgeeks.org/wp-content/uploads/CN.png" alt="TCP Connection Termination - GeeksforGeeks" class="image--center mx-auto" /></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 by:</p>
<ul>
<li><p>HTTP / HTTPS</p>
</li>
<li><p>File transfers</p>
</li>
<li><p>Emails</p>
</li>
<li><p>APIs</p>
</li>
<li><p>Database communication</p>
</li>
</ul>
<p>Without TCP:</p>
<blockquote>
<p>The modern web would break.</p>
</blockquote>
<hr />
<h2 id="heading-final-summary">Final Summary</h2>
<ul>
<li><p>TCP ensures <strong>reliable communication</strong></p>
</li>
<li><p>3-Way Handshake builds trust before data transfer</p>
</li>
<li><p>Sequence numbers &amp; ACKs maintain order</p>
</li>
<li><p>Lost data is retransmitted</p>
</li>
<li><p>Connection is closed gracefully using FIN &amp; ACK</p>
</li>
</ul>
]]></content:encoded></item></channel></rss>