<?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[Computer Network]]></title><description><![CDATA[Computer Network]]></description><link>https://tamsil123cn.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sun, 15 Nov 2026 18:15:43 GMT</lastBuildDate><atom:link href="https://tamsil123cn.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[TCP vs UDP: When to Use What, and How TCP Relates to HTTP]]></title><description><![CDATA[The Internet’s Rules of the Road: TCP, UDP, and HTTP Explained]]></description><link>https://tamsil123cn.hashnode.dev/tcp-vs-udp-when-to-use-what-and-how-tcp-relates-to-http</link><guid isPermaLink="true">https://tamsil123cn.hashnode.dev/tcp-vs-udp-when-to-use-what-and-how-tcp-relates-to-http</guid><category><![CDATA[#computernetwork ]]></category><dc:creator><![CDATA[Tamsil Akhtar]]></dc:creator><pubDate>Sun, 15 Feb 2026 15:17:58 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-why-do-we-even-need-tcp-and-udp"><mark>Why do we even need TCP and UDP?</mark></h2>
<p>The internet is just millions of computers talking to each othe<strong>r</strong><br />But data doesn’t travel as one big piece—it’s broken into small packets and sent across many networks.</p>
<p>So we need rules (<strong>protocols</strong>) to decide:</p>
<ol>
<li><p>How to send data</p>
</li>
<li><p>How fast to send it</p>
</li>
<li><p>What to do if something is lost</p>
</li>
<li><p>How to put data back in order</p>
</li>
</ol>
<p>That’s where TCP and UDP come in. They are transport layer protocols—their job is to move data from one computer to another</p>
<h2 id="heading-tcp"><strong><mark>TCP</mark></strong></h2>
<p>TCP is connection-oriented protocol. Before any data is sent, the sender and receiver must perform a <strong>three-way handshake</strong> to establish a connection.</p>
<h3 id="heading-advantages-of-tcp"><strong>Advantages of TCP</strong> ➼</h3>
<p>• <strong>Reliability:</strong> It gurantees that data reaches the destination in the corect order. If a packet is lost, TCP detects it and retransmits the data.  </p>
<p>• <strong>Flow Control:</strong> It manages the speed of data transmission to ensure the receiver isn't overwhelmed.  </p>
<p>•<strong>Error Checking:</strong> It performs extensive checks to ensure data hasn't been corrupted</p>
<h3 id="heading-uses">USES ➼</h3>
<p>•Web-Browsing(HTTP,HTTPS)</p>
<p>•Emails(SMTP)</p>
<p>•File Transfers(FTP)</p>
<h2 id="heading-udp"><mark>UDP</mark></h2>
<p>UDP is connectionless Protocol. It simply sent packets at the destinaton witout checking if the receiver is ready or if the data actually arrived</p>
<h3 id="heading-advantages-of-udp"><strong>Advantages of UDP</strong> ➼</h3>
<p>• <strong>Speed:</strong> Because there is no handsake and no retansmission of lost packet, it is significantly faster and has lower latency than TCP.  </p>
<p>• <strong>No Guarantees:</strong> Data can arive out of order, or not at all. There is no acknowledgment sent back to the sender.  </p>
<p>• <strong>Lightweight:</strong> It has a very small header size (8 bytes) compared to TCP (20 bytes).</p>
<h3 id="heading-uses-1">USES ➼</h3>
<p>• Online Gaming</p>
<p>• Live Streeming</p>
<p>• Dns Lookups</p>
<h2 id="heading-tcp-courier-careful-phone-call-safe-amp-reliable"><mark>TCP = Courier / Careful Phone Call (Safe &amp; Reliable)</mark></h2>
<p><strong>Think of TCP like sending a package by a trusted courier</strong>:</p>
<ol>
<li><p>You book the courier first (connection is made)</p>
</li>
<li><p>The courier confirms delivery</p>
</li>
<li><p>If the package is lost or damaged, it is sent again</p>
</li>
<li><p>Packages are delivered in the correct order</p>
</li>
<li><p>This takes a bit more time, but it’s safe</p>
</li>
</ol>
<p><strong>like a proper phone call:</strong></p>
<ol>
<li><p>You first check: “Hello, can you hear me?”</p>
</li>
<li><p>If the line is bad, you repeat what you said</p>
</li>
<li><p>You make sure the other person understood</p>
</li>
<li><p>Slower, but reliable communication</p>
</li>
</ol>
<h2 id="heading-udp-live-announcement-live-broadcast-fast-but-risky"><mark>UDP = Live Announcement / Live Broadcast (Fast but Risky)</mark></h2>
<p>Think of UDP like a live announcement on a loudspeaker or live TV broadcast:</p>
<ol>
<li><p>You just speak/send — no setup</p>
</li>
<li><p>You don’t know if everyone heard it</p>
</li>
<li><p>If someone misses a word, you don’t repeat it</p>
</li>
<li><p>Some people may hear parts out of order or miss parts</p>
</li>
<li><p>But it’s very fast and real-time</p>
</li>
</ol>
<p>Or like live streaming:</p>
<ol>
<li><p>If a frame drops, the stream keeps going</p>
</li>
<li><p>It doesn’t stop to fix old data</p>
</li>
<li><p>Speed is more important than perfection</p>
</li>
</ol>
<p>So UDP = Fast, real-time, but risky</p>
<p>Used for: online games, video calls, live streaming, voice chat, etc.</p>
<h2 id="heading-tcp-vs-udp"><mark>TCP VS UDP</mark></h2>
<table><tbody><tr><td><p><strong>TCP(Transmission control protocol)</strong></p></td><td><p><strong>UDP(Uer Datagram protocol)</strong></p></td></tr><tr><td><p>Connection-oriented Protocol</p></td><td><p>Connectionless Protocol</p></td></tr><tr><td><p>Guaranteed delivery of packets</p></td><td><p>No guarantee delivery of packets</p></td></tr><tr><td><p>Maintains sequence during transmission</p></td><td><p>No specific order during transmission</p></td></tr><tr><td><p>Slower than UDP</p></td><td><p>Faster than TCP</p></td></tr><tr><td><p>Retransmits lost packets</p></td><td><p>Does not retransmit</p></td></tr></tbody></table>

<h2 id="heading-what-is-http-and-where-it-fits"><mark>What is HTTP and where it fits</mark></h2>
<p>HTTP (HyperText Transfer Protocol) is called an application-level protocol because it defines how applications communicate, not how data is physically transported over the network.</p>
<p>The <strong>application layer</strong> is the top layer where user applications work, like:</p>
<ol>
<li><p>Web browsers (Chrome, Firefox)</p>
</li>
<li><p>Mobile apps</p>
</li>
<li><p>Web servers</p>
</li>
<li><p>APIs</p>
</li>
</ol>
<p>HTTP works here and decides:</p>
<ol>
<li><p>How a request should look (GET, POST, headers, body, etc.)</p>
</li>
<li><p>How a response should look (status code, headers, data)</p>
</li>
<li><p>How resources like web pages, images, JSON, etc. are requested and sent</p>
</li>
</ol>
<h3 id="heading-why-http-is-not-a-transport-protocol"><mark>Why HTTP is NOT a Transport Protocol?</mark></h3>
<p><strong>Transport protocols</strong> (like <strong>TCP</strong> and <strong>UDP</strong>) are responsible for:</p>
<ol>
<li><p>Breaking data into packets</p>
</li>
<li><p>Sending data reliably or fast</p>
</li>
<li><p>Handling errors, retransmission, ordering</p>
</li>
<li><p>Managing connections</p>
</li>
</ol>
<p>HTTP does not do these things.</p>
<ol>
<li><p>HTTP uses TCP (or sometimes UDP via QUIC in HTTP/3)</p>
</li>
<li><p>HTTP assumes data will be delivered by the transport layer</p>
</li>
<li><p>HTTP only cares about what data is sent and in what format</p>
</li>
</ol>
<hr />
<p><strong>TCP = How data moves</strong></p>
<p><strong>HTTP = What data means and how apps talk</strong></p>
<h2 id="heading-clarifying-the-layering-http-runs-on-top-of-tcp"><mark>Clarifying the Layering : </mark> <strong><mark>HTTP Runs on Top of TCP</mark></strong></h2>
<p>In computer networks, communication is organized into <strong>layers</strong>, where each layer has a specific job.</p>
<ol>
<li><p><strong>HTTP</strong> is an <strong>application-layer protocol</strong>.</p>
</li>
<li><p><strong>TCP</strong> is a <strong>transport-layer protocol</strong>.</p>
</li>
</ol>
<p>This means <strong>HTTP depends on TCP</strong> to send and receive data.</p>
<h3 id="heading-how-they-work-together">How they work together</h3>
<ol>
<li><p>Your <strong>browser</strong> creates an <strong>HTTP request</strong> (e.g., GET /index.html).</p>
</li>
<li><p>HTTP <strong>formats</strong> this request (methods, headers, body, etc.).</p>
</li>
<li><p>This HTTP message is then <strong>handed to TCP</strong>.</p>
</li>
<li><p><strong>TCP</strong> takes care of:</p>
<p> a. Splitting data into packets</p>
<p> b. Reliable delivery</p>
<p> c. Ordering packets</p>
<p> d. Retransmission if packets are lost</p>
</li>
<li><p>The server receives the data via <strong>TCP</strong> and passes it <strong>up to HTTP</strong>, which interprets the request and sends back an HTTP response the same way.</p>
</li>
</ol>
<p>So the flow is:</p>
<ol>
<li><p>Application Layer: HTTP (what to say, format of message)</p>
</li>
<li><p>Transport Layer: TCP (how to send it reliably)</p>
</li>
<li><p>Internet Layer: IP</p>
</li>
<li><p>Link Layer: Ethernet / Wi-Fi</p>
</li>
</ol>
]]></content:encoded></item></channel></rss>