<?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://aniketblog8.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Fri, 25 Sep 2026 12:18:27 GMT</lastBuildDate><atom:link href="https://aniketblog8.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[What is TCP and why it is needed
TCP (Transmission Control Protocol) is a protocol that allows two devices to exchange data safely and reliably over the internet.
In internet data travels through many routers, cables, and networks. Along the way, pro...]]></description><link>https://aniketblog8.hashnode.dev/tcp-working-3-way-handshake-and-reliable-communication</link><guid isPermaLink="true">https://aniketblog8.hashnode.dev/tcp-working-3-way-handshake-and-reliable-communication</guid><category><![CDATA[ChaiCode]]></category><category><![CDATA[Chaiaurcode]]></category><category><![CDATA[ChaiCohort]]></category><category><![CDATA[chai-code ]]></category><category><![CDATA[chai]]></category><category><![CDATA[TCP]]></category><dc:creator><![CDATA[Aniket Saxena]]></dc:creator><pubDate>Sun, 01 Feb 2026 16:54:07 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://unicminds.com/wp-content/uploads/2024/03/TCPIP-Handshake-1020x1024.webp" alt="TCP/IP 3 Way Handshake – Explained in Detail - UnicMinds" /></p>
<h2 id="heading-what-is-tcp-and-why-it-is-needed">What is TCP and why it is needed</h2>
<p><strong>TCP (Transmission Control Protocol)</strong> is a protocol that allows two devices to exchange data <strong>safely and reliably</strong> over the internet.</p>
<p>In internet data travels through many routers, cables, and networks. Along the way, problems happen:</p>
<ul>
<li><p>Data can get lost</p>
</li>
<li><p>Data can arrive in the wrong order</p>
</li>
<li><p>Data can get damaged</p>
</li>
<li><p>The receiver may be overloaded</p>
</li>
</ul>
<p>TCP acts like a <strong>manager</strong> that controls how data is sent and received.</p>
<p>Without TCP: Internet communication would be random and unreliable.</p>
<p>With TCP: Data is delivered correctly, in order, and completely.</p>
<p>That’s why websites, emails, banking apps, and file downloads all use TCP.</p>
<h2 id="heading-problems-tcp-is-designed-to-solve">Problems TCP is designed to solve</h2>
<p>Packet loss — Some data disappears</p>
<p>Out-of-order packets — Message becomes jumbled</p>
<p>Duplicate packets — Same data received twice</p>
<p>Data corruption — Bits change during travel</p>
<p>Receiver overload — System crashes</p>
<p>Network congestion — Internet becomes slow</p>
<h2 id="heading-what-is-the-tcp-3-way-handshake">What is the TCP 3-Way Handshake</h2>
<p>Before sending real data, TCP must <strong>establish a connection</strong>.</p>
<p>It’s like knocking before entering a room.</p>
<p>This process is called the <strong>3-Way Handshake</strong>.</p>
<p>Purpose:<br />Confirm both devices are alive<br />Synchronize sequence numbers<br />Prepare resources for communication</p>
<h2 id="heading-step-by-step-working-of-syn-syn-ack-and-ack">Step-by-step working of SYN, SYN-ACK, and ACK</h2>
<h3 id="heading-step-1-syn">Step 1 — SYN</h3>
<p>Client → Server</p>
<p>Means: “I want to connect. My data numbering starts from X.”</p>
<h3 id="heading-step-2-syn-ack">Step 2 — SYN-ACK</h3>
<p>Server → Client</p>
<p>Means:</p>
<p>“I received your request. I’m ready. My numbering starts from Y.”</p>
<h3 id="heading-step-3-ack">Step 3 — ACK</h3>
<p>Client → Server</p>
<p>Means:</p>
<p>“I received your response. Connection established.”</p>
<p>Now both sides agree → data transfer begins.</p>
<h2 id="heading-how-data-transfer-works-in-tcp">How data transfer works in TCP</h2>
<p>TCP breaks big data into smaller pieces called <strong>segments</strong>.</p>
<p>Each segment has:</p>
<p>Data</p>
<p>Sequence number</p>
<p>Checksum</p>
<h2 id="heading-how-tcp-ensures-reliability-order-and-correctness">How TCP ensures reliability, order, and correctness</h2>
<p>TCP uses multiple mechanisms together:</p>
<h3 id="heading-sequence-numbers">Sequence Numbers</h3>
<p>Keep data in correct order.</p>
<h3 id="heading-acknowledgements">Acknowledgements</h3>
<p>Confirm receipt.</p>
<h3 id="heading-retransmission">Retransmission</h3>
<p>If ACK not received → resend data.</p>
<h3 id="heading-flow-control">Flow Control</h3>
<p>Receiver tells sender how much data it can handle (window size).</p>
<h2 id="heading-how-a-tcp-connection-is-closed">How a TCP connection is closed</h2>
<p>Connection closing also follows rules.</p>
<h3 id="heading-steps">Steps:</h3>
<ol>
<li><p>Client → <strong>FIN</strong><br /> “I’m done sending.”</p>
</li>
<li><p>Server → <strong>ACK</strong><br /> “Got your FIN.”</p>
</li>
<li><p>Server → <strong>FIN</strong><br /> “I’m done too.”</p>
</li>
<li><p>Client → <strong>ACK</strong><br /> Connection fully closed.</p>
</li>
</ol>
]]></content:encoded></item></channel></rss>