<?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://tcpworking3wayhandshaking.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Wed, 16 Sep 2026 04:10:22 GMT</lastBuildDate><atom:link href="https://tcpworking3wayhandshaking.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[TCP (Transmission Control Protocol) and How It Establishes Reliable Communication
TCP, or Transmission Control Protocol, is a communication protocol that works at the Transport Layer of the networking model. Its main responsibility is to ensure that ...]]></description><link>https://tcpworking3wayhandshaking.hashnode.dev/tcp-working-3-way-handshake-and-reliable-communication</link><guid isPermaLink="true">https://tcpworking3wayhandshaking.hashnode.dev/tcp-working-3-way-handshake-and-reliable-communication</guid><category><![CDATA[ChaiCode]]></category><category><![CDATA[Cohort2026]]></category><category><![CDATA[TCP Working: 3-Way Handshake & Reliable Communication]]></category><category><![CDATA[TCP]]></category><dc:creator><![CDATA[garvit oberoi]]></dc:creator><pubDate>Sun, 01 Feb 2026 13:34:36 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-tcp-transmission-control-protocol-and-how-it-establishes-reliable-communication"><strong>TCP (Transmission Control Protocol) and How It Establishes Reliable Communication</strong></h2>
<p>TCP, or <strong>Transmission Control Protocol</strong>, is a communication protocol that works at the <strong>Transport Layer</strong> of the networking model. Its main responsibility is to ensure that data moves safely and correctly from one device to another over a network.</p>
<p>TCP is widely used because it provides <strong>reliable and ordered data delivery</strong>. It prevents data loss, duplication, and disorder during transmission. One of the main reasons TCP is reliable is its connection setup mechanism known as the 3-Way Handshake.</p>
<p><img src="https://media.geeksforgeeks.org/wp-content/uploads/handshake-1.png" alt="TCP 3 Way Handshaking" /></p>
<h2 id="heading-mechanism-of-the-3-way-handshake"><strong>Mechanism of the 3-Way Handshake</strong></h2>
<p>Before actual data transmission begins, TCP first establishes a secure and synchronized connection between the client and the server. This process ensures that both ends are active, reachable, and ready to communicate.</p>
<p>As the name suggests, the 3-Way Handshake consists of three steps.</p>
<h3 id="heading-step-1-syn-synchronize"><strong>Step 1: SYN (Synchronize)</strong></h3>
<p>The process begins when the <strong>client initiates the connection</strong> by sending a <strong>SYN packet</strong> to the server.</p>
<p>This first packet contains:</p>
<ul>
<li><p>SYN flag set to 1 (requesting a connection)</p>
</li>
<li><p>Initial Sequence Number (ISN) from the client</p>
</li>
<li><p>Source and destination port details</p>
</li>
</ul>
<p>The SYN flag indicates a request to start a new TCP session. When SYN equals 1, it means a connection request is being made. When SYN equals 0, normal data communication occurs.</p>
<p>The Initial Sequence Number plays an important role in maintaining reliability. It helps in tracking data packets and prevents confusion caused by delayed or duplicate packets from previous sessions.</p>
<h3 id="heading-step-2-syn-ack-synchronize-acknowledge"><strong>Step 2: SYN-ACK (Synchronize + Acknowledge)</strong></h3>
<p>If the server is available and ready to communicate, it responds with a <strong>SYN-ACK packet</strong>.</p>
<p>This packet includes:</p>
<ul>
<li><p>Acknowledgment of the client’s SYN request</p>
</li>
<li><p>Server’s own Initial Sequence Number</p>
</li>
</ul>
<p>Here, the server confirms receipt of the client’s request and also prepares to establish the connection by sending its sequence number.</p>
<h3 id="heading-step-3-ack-acknowledge"><strong>Step 3: ACK (Acknowledge)</strong></h3>
<p>The final step completes the connection setup.</p>
<p>The client sends an <strong>ACK packet</strong> back to the server containing:</p>
<ul>
<li><p>ACK flag set to 1</p>
</li>
<li><p>Updated sequence number</p>
</li>
<li><p>Window size information</p>
</li>
<li><p>Source and destination addressing details</p>
</li>
</ul>
<p>The window size represents how much data the client can receive without overflowing its buffer.</p>
<p>Once this acknowledgment is received, both sides confirm synchronization, and the <strong>TCP connection becomes active</strong>. Only after this stage does actual data transmission begin.</p>
<p>This handshake process is required every time a TCP connection is initiated.</p>
<h2 id="heading-how-a-tcp-connection-is-closed"><strong>How a TCP Connection is Closed</strong></h2>
<p>After communication is completed, the TCP connection must be properly terminated. Unlike connection setup, connection termination involves <strong>four steps</strong>, ensuring both sides stop sending data safely.</p>
<h3 id="heading-step-1-fin-finish"><strong>Step 1: FIN (Finish)</strong></h3>
<p>The client sends a <strong>FIN segment</strong>, indicating that it has finished sending data and wants to close its sending side of the connection.</p>
<h3 id="heading-step-2-ack-acknowledgment"><strong>Step 2: ACK (Acknowledgment)</strong></h3>
<p>The server responds with an <strong>ACK</strong>, confirming it received the client's close request.</p>
<h3 id="heading-step-3-fin-from-server"><strong>Step 3: FIN from Server</strong></h3>
<p>Once the server has finished sending its remaining data, it sends its own <strong>FIN segment</strong> to signal closure from its side.</p>
<h3 id="heading-tep-4-final-ack"><strong>tep 4: Final ACK</strong></h3>
<p>The client acknowledges the server’s FIN message with a final ACK packet. After this exchange, the TCP connection is completely closed.</p>
<h2 id="heading-conclusion"><strong>Conclusion</strong></h2>
<p>TCP ensures reliable communication by carefully managing both <strong>connection setup and termination</strong>. The <strong>3-Way Handshake</strong> guarantees both devices are synchronized before data exchange, while the <strong>4-step termination process</strong> safely closes the connection.</p>
<p>Because of these mechanisms, TCP remains one of the most dependable protocols used for internet communication today.</p>
]]></content:encoded></item></channel></rss>