<?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-three-wayhandshake.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sun, 20 Sep 2026 22:51:16 GMT</lastBuildDate><atom:link href="https://tcp-three-wayhandshake.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[When we use the internet—open a website, send a message, or watch a video—data is always moving from one computer to another.
But what if data is sent without any rules?

Messages can get lost

Data can arrive in the wrong order

Some data may be dup...]]></description><link>https://tcp-three-wayhandshake.hashnode.dev/tcp-working-3-way-handshake-and-reliable-communication</link><guid isPermaLink="true">https://tcp-three-wayhandshake.hashnode.dev/tcp-working-3-way-handshake-and-reliable-communication</guid><category><![CDATA[ChaiCode]]></category><category><![CDATA[ChaiCohort]]></category><category><![CDATA[Chaiaurcode]]></category><category><![CDATA[tcp-3-way-handshake]]></category><category><![CDATA[TCP Handshake]]></category><dc:creator><![CDATA[Tarun Kumar]]></dc:creator><pubDate>Sun, 01 Feb 2026 15:55:51 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769961015056/0dff29fd-0029-4579-9309-94667264f0dc.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When we use the internet—open a website, send a message, or watch a video—data is always moving from one computer to another.</p>
<p>But what if data is sent <strong>without any rules</strong>?</p>
<ul>
<li><p>Messages can get lost</p>
</li>
<li><p>Data can arrive in the wrong order</p>
</li>
<li><p>Some data may be duplicated</p>
</li>
<li><p>Receiver may not understand anything</p>
</li>
</ul>
<p>To solve these problems, we use <strong>TCP</strong>.</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 (protocol) used on the internet.</p>
<p>It helps computers <strong>send and receive data safely and correctly</strong>.</p>
<p>TCP is needed because:</p>
<ul>
<li><p>It makes sure data reaches the correct destination</p>
</li>
<li><p>It makes sure no data is lost</p>
</li>
<li><p>It sends data in the correct order</p>
</li>
<li><p>It checks if data is received properly</p>
</li>
</ul>
<p>Without TCP, internet communication would be <strong>unreliable and messy</strong>.</p>
<hr />
<h2 id="heading-problems-tcp-is-designed-to-solve">Problems TCP Is Designed to Solve</h2>
<p>TCP solves many problems like:</p>
<ul>
<li><p>Data loss</p>
</li>
<li><p>Data coming in the wrong order</p>
</li>
<li><p>Duplicate data</p>
</li>
<li><p>Broken or incomplete messages</p>
</li>
</ul>
<p>TCP makes sure:</p>
<ul>
<li><p>All data is delivered</p>
</li>
<li><p>Data is in the right order</p>
</li>
<li><p>Missing data is sent again</p>
</li>
</ul>
<hr />
<h2 id="heading-what-is-the-tcp-3-way-handshake">What Is the TCP 3-Way Handshake?</h2>
<p>Before sending data, TCP <strong>first creates a connection</strong> between the client and the server.</p>
<p>This connection setup is called the <strong>3-Way Handshake</strong>.</p>
<p>It is like starting a conversation politely before talking.</p>
<hr />
<h2 id="heading-3-way-handshake-using-a-simple-example">3-Way Handshake Using a Simple Example</h2>
<p>Imagine two people talking:</p>
<ol>
<li><p><strong>Client:</strong> “Can I talk to you?”</p>
</li>
<li><p><strong>Server:</strong> “Yes, I’m ready. Can you hear me?”</p>
</li>
<li><p><strong>Client:</strong> “Yes, I can hear you.”</p>
</li>
</ol>
<p>Now both are ready to talk.</p>
<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-synchronize">Step 1: SYN (Synchronize)</h3>
<ul>
<li><p>Client sends a <strong>SYN</strong> message to the server</p>
</li>
<li><p>Means: <em>“I want to start a connection”</em></p>
</li>
</ul>
<h3 id="heading-step-2-syn-ack-synchronize-acknowledge">Step 2: SYN-ACK (Synchronize + Acknowledge)</h3>
<ul>
<li><p>Server replies with <strong>SYN-ACK</strong></p>
</li>
<li><p>Means: <em>“I received your request and I’m ready”</em></p>
</li>
</ul>
<h3 id="heading-step-3-ack-acknowledge">Step 3: ACK (Acknowledge)</h3>
<ul>
<li><p>Client sends <strong>ACK</strong> back to the server</p>
</li>
<li><p>Means: <em>“Great! Let’s start communication”</em></p>
</li>
</ul>
<p>Connection is now established.</p>
<hr />
<h2 id="heading-how-data-transfer-works-in-tcp">How Data Transfer Works in TCP</h2>
<p>Once the connection is ready:</p>
<ul>
<li><p>Data is broken into <strong>small packets</strong></p>
</li>
<li><p>Each packet has a <strong>sequence number</strong></p>
</li>
<li><p>Receiver sends back an <strong>ACK</strong> for received packets</p>
</li>
</ul>
<p>This helps TCP track data properly.</p>
<hr />
<h2 id="heading-sequence-numbers-and-acknowledgements-simple-view">Sequence Numbers and Acknowledgements (Simple View)</h2>
<ul>
<li><p><strong>Sequence number:</strong> Order of data</p>
</li>
<li><p><strong>ACK number:</strong> Confirms received data</p>
</li>
</ul>
<p>Example:</p>
<ul>
<li><p>Client sends packet 1, 2, 3</p>
</li>
<li><p>Server replies: <em>“I received packet 1 and 2”</em></p>
</li>
<li><p>If packet 3 is missing → TCP sends it again</p>
</li>
</ul>
<hr />
<h2 id="heading-how-tcp-ensures-reliability">How TCP Ensures Reliability</h2>
<p>TCP ensures reliability by:</p>
<h3 id="heading-correct-order">Correct Order</h3>
<p>Packets are reordered using sequence numbers.</p>
<h3 id="heading-packet-loss-handling">Packet Loss Handling</h3>
<p>If data is lost:</p>
<ul>
<li><p>Receiver does not send ACK</p>
</li>
<li><p>Sender resends the missing data</p>
</li>
</ul>
<h3 id="heading-error-checking">Error Checking</h3>
<p>TCP checks if data is corrupted and fixes it.</p>
<hr />
<h2 id="heading-what-happens-if-a-packet-is-lost">What Happens If a Packet Is Lost?</h2>
<ol>
<li><p>Sender sends data</p>
</li>
<li><p>Receiver misses one packet</p>
</li>
<li><p>No ACK is received</p>
</li>
<li><p>Sender <strong>retransmits</strong> the packet</p>
</li>
</ol>
<p>User never notices this — TCP handles everything silently.</p>
<hr />
<h2 id="heading-how-tcp-connection-is-closed">How TCP Connection Is Closed</h2>
<p>When communication is done, TCP <strong>closes the connection properly</strong>.</p>
<h3 id="heading-connection-termination-steps">Connection Termination Steps:</h3>
<ol>
<li><p><strong>FIN</strong> – Client says: <em>“I’m done sending data”</em></p>
</li>
<li><p><strong>ACK</strong> – Server confirms</p>
</li>
<li><p><strong>FIN</strong> – Server also finishes</p>
</li>
<li><p><strong>ACK</strong> – Client confirms</p>
</li>
</ol>
<p>Connection is now closed safely.</p>
<hr />
<h2 id="heading-tcp-connection-lifecycle">TCP Connection Lifecycle</h2>
<ol>
<li><p>Connection Establishment (3-Way Handshake)</p>
</li>
<li><p>Data Transfer</p>
</li>
<li><p>Connection Termination</p>
</li>
</ol>
<hr />
<h2 id="heading-why-tcp-is-important-for-web-development">Why TCP Is Important for Web Development</h2>
<p>TCP is used in:</p>
<ul>
<li><p>HTTP / HTTPS</p>
</li>
<li><p>Web browsing</p>
</li>
<li><p>API communication</p>
</li>
<li><p>File downloads</p>
</li>
</ul>
<p>Without TCP, websites would not load properly.</p>
<hr />
<h2 id="heading-conclusion">Conclusion</h2>
<p>TCP is the backbone of reliable internet communication.</p>
<ul>
<li><p>It creates a safe connection</p>
</li>
<li><p>Sends data correctly</p>
</li>
<li><p>Handles errors and packet loss</p>
</li>
<li><p>Closes connections properly</p>
</li>
</ul>
<p>The <strong>3-Way Handshake</strong> is the first and most important step that makes all this possible.</p>
<hr />
<p><strong>TCP = Reliable, Ordered, and Safe Communication</strong></p>
<hr />
]]></content:encoded></item></channel></rss>