<?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]]></title><description><![CDATA[TCP Working: 3-Way]]></description><link>https://tcpworking009.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Thu, 10 Sep 2026 23:56:04 GMT</lastBuildDate><atom:link href="https://tcpworking009.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[TCP Working: The 3-Way Handshake and Reliable Communication]]></title><description><![CDATA[In the vast ecosystem of the internet, where millions of data packets are sent every second, ensuring that information reaches its destination accurately and in order is a monumental task. This is where TCP (Transmission Control Protocol) comes into ...]]></description><link>https://tcpworking009.hashnode.dev/tcp-working-the-3-way-handshake-and-reliable-communication</link><guid isPermaLink="true">https://tcpworking009.hashnode.dev/tcp-working-the-3-way-handshake-and-reliable-communication</guid><category><![CDATA[TCP]]></category><category><![CDATA[ChaiCode]]></category><dc:creator><![CDATA[Akanksha Singh]]></dc:creator><pubDate>Wed, 28 Jan 2026 07:49:29 GMT</pubDate><content:encoded><![CDATA[<p>In the vast ecosystem of the internet, where millions of data packets are sent every second, ensuring that information reaches its destination accurately and in order is a monumental task. This is where <strong>TCP (Transmission Control Protocol)</strong> comes into play. Often referred to as the backbone of internet communication, TCP provides a reliable, connection-oriented service that sits at the Transport Layer of the OSI model.</p>
<p>In this article, we will break down how TCP works, the problems it solves, and the famous "Three-Way Handshake" that makes it all possible.</p>
<hr />
<h3 id="heading-1-what-is-tcp-and-what-is-it-designed-to-solve">1. What is TCP and What is it Designed to Solve?</h3>
<p>TCP is a communications standard that enables application programs and computing devices to exchange messages over a network. It is designed to send packets across the internet and ensure the successful delivery of data and messages over networks.</p>
<p><strong>The Core Problems TCP Solves:</strong></p>
<p><strong>-Reliability:</strong> Unlike its counterpart UDP (User Datagram Protocol), which sends data without checking if it arrived, TCP ensures every byte is accounted for.</p>
<p><strong>-Data Ordering:</strong> Data is often broken into small packets that may take different routes to reach a destination. TCP reassembles them in the correct sequence.</p>
<p><strong>-Error Checking:</strong> TCP detects if data has been corrupted during transmission.</p>
<p><strong>-Flow Control:</strong> It manages the rate of data transmission between two nodes to prevent a fast sender from overwhelming a slow receiver.</p>
<hr />
<h3 id="heading-2-the-step-by-step-working-of-syn-syn-ack-and-ack">2. The Step-by-Step Working of SYN, SYN-ACK, and ACK</h3>
<p>Before TCP can transmit data, it must establish a connection. This is done through a process called the <strong>3-Way Handshake</strong>. It involves three specific types of segments:</p>
<ol>
<li><p><strong>SYN (Synchronize):</strong> The client sends a SYN packet to the server to initiate a connection. It includes a random sequence number to start the communication.</p>
</li>
<li><p><strong>SYN-ACK (Synchronize-Acknowledgment):</strong> The server receives the SYN and responds with a SYN-ACK. This signal confirms it received the request and sends its own sequence number.</p>
</li>
<li><p><strong>ACK (Acknowledgment):</strong> Finally, the client sends an ACK packet back to the server. This confirms that both sides are ready to communicate. The connection is now "Established."</p>
</li>
</ol>
<hr />
<h3 id="heading-3-understanding-sequence-numbers">3. Understanding Sequence Numbers</h3>
<p>A critical part of the handshake and data transfer is the <strong>Sequence Number</strong>. Every packet sent via TCP is assigned a unique number. These numbers allow the receiving end to:</p>
<p>-Identify missing packets.</p>
<p>-Put packets back in the correct order if they arrive out of sequence.</p>
<p>-Discard duplicate packets.</p>
<p>Without sequence numbers, the internet would be a chaotic mess of fragmented information.</p>
<hr />
<h3 id="heading-4-how-data-transfer-works-in-tcp">4. How Data Transfer Works in TCP</h3>
<p>Once the connection is established, the data transfer phase begins. TCP breaks large data files into smaller chunks called <strong>segments</strong>.</p>
<p>As segments are sent, the receiver must send an <strong>Acknowledgment (ACK)</strong> for every piece of data it receives. If the sender does not receive an ACK within a certain timeframe, it assumes the packet was lost and automatically <strong>retransmits</strong> the data. This "Positive Acknowledgment with Retransmission" is the secret to TCP's reliability.</p>
<hr />
<h3 id="heading-5-ensuring-correctness-and-integrity">5. Ensuring Correctness and Integrity</h3>
<p>TCP ensures "correctness" through a mechanism called a <strong>Checksum</strong>. Each segment contains a checksum field that the receiver uses to mathematically verify that the data wasn't corrupted by electrical interference or hardware errors during transit. If the checksum fails, the packet is dropped, and the sender is prompted to try again.</p>
<hr />
<h3 id="heading-6-closing-the-connection-the-4-way-handshake">6. Closing the Connection: The 4-Way Handshake</h3>
<p>When the data exchange is finished, TCP doesn't just "hang up." It uses a formal closing process, often involving four steps:</p>
<ol>
<li><p><strong>FIN:</strong> The client sends a FIN (Finish) packet.</p>
</li>
<li><p><strong>ACK:</strong> The server acknowledges the request.</p>
</li>
<li><p><strong>FIN:</strong> Once the server finishes sending its remaining data, it sends its own FIN packet.</p>
</li>
<li><p><strong>ACK:</strong> The client acknowledges the server's FIN, and the connection is officially closed.</p>
</li>
</ol>
]]></content:encoded></item></channel></rss>