<?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[Working of Transmission Control Protocol]]></title><description><![CDATA[Working of Transmission Control Protocol]]></description><link>https://working-of-transmission-control-protocol.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 19:11:57 GMT</lastBuildDate><atom:link href="https://working-of-transmission-control-protocol.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[Just imagine sending an important message to someone, but there are no rules about how messages should be sent. Some messages arrive late, some arrive…]]></description><link>https://working-of-transmission-control-protocol.hashnode.dev/tcp-working-3-way-handshake-and-reliable-communication</link><guid isPermaLink="true">https://working-of-transmission-control-protocol.hashnode.dev/tcp-working-3-way-handshake-and-reliable-communication</guid><category><![CDATA[tcp3wayhandshacking]]></category><category><![CDATA[TCP]]></category><dc:creator><![CDATA[Aayush Kumar]]></dc:creator><pubDate>Fri, 30 Jan 2026 14:40:40 GMT</pubDate><content:encoded><![CDATA[<p>Just imagine sending an important message to someone, but there are <strong>no rules</strong> about how messages should be sent. Some messages arrive late, some arrive twice, and some never arrive at all.</p>
<p>That’s exactly what would happen on the internet <strong>without TCP</strong>.</p>
<p>To prevent this chaos, the internet uses <strong>TCP (Transmission Control Protocol)</strong> - a protocol designed to make communication <strong>reliable, ordered, and error-free</strong>.</p>
<h2 id="heading-what-happens-if-data-is-sent-without-rules">What Happens If Data Is Sent Without Rules?</h2>
<p>If computers or mobile phones send data without any rules:</p>
<ul>
<li><p>Data packets may arrive <strong>out of order</strong></p>
</li>
<li><p>Some packets may get <strong>lost</strong></p>
</li>
<li><p>The receiver won’t know <strong>which data is missing</strong></p>
</li>
<li><p>Duplicate data may be received</p>
</li>
<li><p>No clear start or end of communication</p>
</li>
</ul>
<p>This kind of communication is <strong>unreliable and unsafe</strong> - especially for things like file transfers, emails, or web pages.</p>
<p>That’s why TCP exists.</p>
<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 protocol that ensures data is:</p>
<ul>
<li><p>Delivered <strong>safely and reliably</strong></p>
</li>
<li><p>Received in the <strong>correct order</strong></p>
</li>
<li><p><strong>Error-free</strong></p>
</li>
<li><p>Fully received before the connection is closed</p>
</li>
</ul>
<p>TCP is used in applications where accuracy matters, such as:</p>
<ul>
<li><p>Web browsing (HTTP/HTTPS)</p>
</li>
<li><p>Email (SMTP)</p>
</li>
<li><p>File transfer (FTP)</p>
</li>
</ul>
<h2 id="heading-problems-tcp-is-designed-to-solve">Problems TCP Is Designed to Solve</h2>
<p>TCP was created to handle these core problems:</p>
<ul>
<li><p><strong>Packet loss</strong> – data may disappear during transmission</p>
</li>
<li><p><strong>Out-of-order delivery</strong> – packets may arrive in the wrong order</p>
</li>
<li><p><strong>Duplicate packets</strong> – the same data may arrive twice</p>
</li>
<li><p><strong>No confirmation</strong> – sender doesn’t know if data was received</p>
</li>
</ul>
<p>TCP solves all of these problems.</p>
<h2 id="heading-what-is-the-tcp-3-way-handshake">What Is the TCP 3-Way Handshake?</h2>
<p>Before sending actual data, TCP first <strong>establishes a connection</strong> between the client and server.</p>
<p>This connection setup is called the <strong>3-Way Handshake</strong>.</p>
<p>Think of it like starting a phone call:</p>
<blockquote>
<p><strong>Client:</strong> “Can I talk to you?”<br /><strong>Server:</strong> “Yes, I can hear you. Can you hear me?”<br /><strong>Client:</strong> “Yes, I can hear you too.”</p>
</blockquote>
<p>Only after this confirmation does the real conversation begin.</p>
<h2 id="heading-tcp-3-way-handshake-step-by-step">TCP 3-Way Handshake: Step-by-Step</h2>
<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>
<h3 id="heading-syn-synchronize">SYN (Synchronize)</h3>
<ul>
<li><p>The <strong>client</strong> sends a packet with the <strong>SYN</strong> flag set</p>
</li>
<li><p>This means:<br />  <em>“I want to start a connection and synchronize sequence numbers.”</em></p>
</li>
</ul>
<h3 id="heading-syn-ack-synchronize-acknowledge">SYN-ACK (Synchronize + Acknowledge)</h3>
<ul>
<li><p>The <strong>server</strong> responds with <strong>SYN + ACK</strong></p>
</li>
<li><p>This means:<br />  <em>“I received your request, and I’m ready too.”</em></p>
</li>
</ul>
<h3 id="heading-ack-acknowledge">ACK (Acknowledge)</h3>
<ul>
<li><p>The <strong>client</strong> sends an <strong>ACK</strong></p>
</li>
<li><p>This confirms:<br />  <em>“Connection established. Let’s start data transfer.”</em></p>
</li>
</ul>
<p>After this step, the TCP connection is <strong>successfully established</strong>.</p>
<h2 id="heading-how-data-transfer-works-in-tcp">How Data Transfer Works in TCP</h2>
<p>Once the connection is established, actual data is sent.</p>
<p>TCP breaks data into <strong>small segments</strong>. Each segment contains:</p>
<ul>
<li><p><strong>Sequence Number</strong> – position of data</p>
</li>
<li><p><strong>Acknowledgement Number</strong> – confirms received data</p>
</li>
</ul>
<p>Example</p>
<ul>
<li><p>Client sends data with sequence number <strong>100</strong></p>
</li>
<li><p>Server replies:<br />  <strong>ACK = 150</strong> → <em>“I received everything till 149, send next.”</em></p>
</li>
</ul>
<h2 id="heading-how-tcp-ensures-reliability-order-and-correctness">How TCP Ensures Reliability, Order, and Correctness</h2>
<p>TCP uses several mechanisms:</p>
<h3 id="heading-1-sequence-numbers">1. Sequence Numbers</h3>
<p>Ensure data is <strong>reassembled in the correct order</strong></p>
<h3 id="heading-2-acknowledgements-acks">2. Acknowledgements (ACKs)</h3>
<p>Confirm which data has been received</p>
<h3 id="heading-3-retransmission">3. Retransmission</h3>
<p>If ACK is not received, data is <strong>sent again</strong></p>
<h3 id="heading-4-error-checking">4. Error Checking</h3>
<p>Corrupted packets are <strong>discarded and resent</strong></p>
<p>Together, these features make TCP <strong>reliable and accurate</strong>.</p>
<h2 id="heading-how-a-tcp-connection-is-closed">How a TCP Connection Is Closed</h2>
<p>Once data transfer is complete, TCP <strong>closes the connection properly</strong>.</p>
<h3 id="heading-connection-termination-steps">Connection Termination Steps</h3>
<ol>
<li><p><strong>FIN</strong> – Sender says: <em>“I’m done sending data.”</em></p>
</li>
<li><p><strong>ACK</strong> – Receiver acknowledges</p>
</li>
<li><p><strong>FIN</strong> – Receiver also finishes</p>
</li>
<li><p><strong>ACK</strong> – Final confirmation</p>
</li>
</ol>
<p>Only after those steps connection fully closed.</p>
<h2 id="heading-tcp-connection-lifecycle">TCP Connection Lifecycle</h2>
<p><strong>Establish → Transfer → Close</strong></p>
<p>This structured lifecycle ensures <strong>safe and reliable communication</strong> every time.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>TCP works quietly in the background, but it plays a <strong>critical role</strong> in how the internet functions.<br />From loading a webpage to sending emails, TCP ensures that <strong>data arrives exactly as it should</strong>.</p>
<p>Understanding TCP’s 3-Way Handshake helps us see how computers <strong>build trust before communication</strong>, just like humans do.</p>
]]></content:encoded></item></channel></rss>