<?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 Vs UDP]]></title><description><![CDATA[TCP Vs UDP]]></description><link>https://tcp-udp-http.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Wed, 04 Nov 2026 01:20:26 GMT</lastBuildDate><atom:link href="https://tcp-udp-http.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[Compare TCP and UDP, learn when to use each, and understand TCP's relationship with HTTP and its role in reliable data delivery]]></description><link>https://tcp-udp-http.hashnode.dev/tcp-vs-udp-when-to-use-what-and-how-tcp-relates-to-http</link><guid isPermaLink="true">https://tcp-udp-http.hashnode.dev/tcp-vs-udp-when-to-use-what-and-how-tcp-relates-to-http</guid><category><![CDATA[tcp vs udp]]></category><category><![CDATA[TCP]]></category><category><![CDATA[UDP]]></category><dc:creator><![CDATA[Kumari Swati]]></dc:creator><pubDate>Sun, 01 Feb 2026 08:32:16 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-tcp"><strong>TCP</strong></h2>
<p>TCP stands for Transfer Control Protocols. As the name suggested TCP controls the transfer of the data using some rules and protocols between the systems over the network.</p>
<p>TCP is a most widely used protocols in transportation layer</p>
<p>It is a connection oriented and before sending the data it creates the connection between the sender and receiver by using the three way handshaking and closing the connection by using for way handshaking mechanism.</p>
<p><strong><mark>The three ways are SYN, SYN-ACK, and ACK</mark></strong></p>
<p><strong>SYN:</strong> SYN is known as synchronization. In this step first The sender and receiver made the connection by initializing the request from the sender to the receiver end.</p>
<p><strong>SYN-ACK:</strong> SYN-ACK is known as synchronization and Acknowledgment. when in first step the connection requests to other end the receiver acknowledge the connection(sync) request.</p>
<p><strong>ACK:</strong> ACK is known as Acknowledgement and this is the third and last step of handshaking where at last sender acknowledged that communication message.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769866820965/c55278c7-768f-4f88-8596-6db73895b2cb.png" alt /></p>
<p>Similarly before the data transfer three way handshaking are working before closing the communication 4-way handshake will complete. four ways are : <mark>FIN, ACK, FIN, ACK.</mark></p>
<p><strong>FIN:</strong> At first step the sender sent final signal to the receiver for closing the connection.</p>
<p><strong>ACK:</strong> Second step the receiver acknowledge that request from the sender.</p>
<p><strong>FIN:</strong> Third step again receiver sent the final FIN from his own end for closing the connection</p>
<p><strong>ACK:</strong> and at the end sender acknowledge that response from the receiver.</p>
<p><img src="https://ipcisco.com/wp-content/uploads/2018/10/tcp-4-way-handshake.jpg" alt="tcp-4-way-handshake, four-way handshake messaging of TCP, FIN, FIN-ACK messages" class="image--center mx-auto" /></p>
<p>TCP divides data into smaller segments and assigns each segment a sequence number. These sequence numbers helps the receiver understand the correct order of data and detect if any data is missing.</p>
<p>After receiving data, the receiver sends an Acknowledgment (ACK) back to the sender.<br />The ACK number tells the sender the next expected sequence number.</p>
<h3 id="heading-how-tcp-works"><strong>How TCP works</strong></h3>
<p>Lets see with example : the sender sent the data of 10 bits with sequence number (lets say 1) and from the receiver end it replies with acknowledge number with the size 11 bits.</p>
<p>Similarly for next 10 bit it sends the data with updated sequence number 11 and again from the receiver end it replies with the acknowledgment with 11 bits size.</p>
<h2 id="heading-udp">UDP</h2>
<p>UDP Stands for User datagram protocol. It is also a transport layer protocol but the difference is that it do not form any connection and verify the sequence its directly sends the data to the receiver end.</p>
<p>UDP does not make 3-way handshaking and 4-way handshaking mechanism for transmission of data.</p>
<h3 id="heading-how-udp-works">How UDP Works</h3>
<p>Sender sent the data in small units called as datagram and each datagram is transmitted independently without any 3-way handshaking process to the receiver end and sender do not wait for any confirmation from receiver, it continuously sends the data to the receiver.</p>
<h2 id="heading-key-differences-between-tcp-and-udp">Key differences between TCP and UDP</h2>
<p>Before</p>
<h3 id="heading-reliability">Reliability</h3>
<p>The TCP is more reliable than the UDP because the TCP ensures the data correctness and sequence of data should be maintained because it uses the 3-way handshaking.</p>
<h3 id="heading-ordering">Ordering</h3>
<p>TCP maintains the order of the sequence of the data but UDP do not care for the sequence its continuously sends the datagram to the receiver without getting any acknowledgment.</p>
<h3 id="heading-loss-detection">Loss Detection</h3>
<p>The TCP uses acknowledgment based mechanism to detect data loss during transmission it sends the data in segments and each segment identified as sequence number and receiver successfully receive the data, it sends the acknowledgment confirming and asking for next segment.</p>
<h3 id="heading-retransmission">Retransmission</h3>
<p>If the sender do not get any acknowledgment it assumes the data is not reliable and retransmit the data one more time to the receiver. So TCP has retransmission quality if data were lost. and UDP do not have.</p>
<h3 id="heading-congestion-control">Congestion control</h3>
<p>Congestion is control the traffic of data. The TCP uses the acknowledgment approach. it uses the three way handshaking. while UDP is a connectionless protocol that transmits data at a fixed rate, regardless of network conditions. </p>
<h2 id="heading-when-to-use-tcp-amp-common-real-world-examples-of-tcp">When to use TCP &amp; Common real-world examples of TCP</h2>
<p>Use TCP when accuracy, reliability, and complete data delivery are more important than speed.</p>
<p><strong>Example:</strong> In the Telephonic communication we can Use TCP how ? when we call someone we speak and wait for other end to confirm that am i audible or not. If our voice break we will repeat and conversion is continued in order. Here in the conversion 3- way handshaking is working.</p>
<p>similarly in delivery of some courier the some tracking number will be given to the particular parcel just like sequence no if we got our parcel the tracking is stopped and if parcel were lost resend the delivery.</p>
<h2 id="heading-when-to-use-udp-amp-common-real-world-examples-of-udp">When to use UDP &amp; Common real-world examples of UDP</h2>
<p>Use UDP when speed and real-time delivery are more important than reliability.</p>
<p><strong>Example:</strong> Announcement are made through loudspeaker some people will here it if they do not want they do not here it.</p>
<p>similarly in live broadcast the news will broadcast continuously to the radio or in live cricket match if the internet connection is lost the data will lost of some part if the network range will enhance will got the data, no rewind are made.</p>
<h2 id="heading-what-is-http-and-where-it-fits">What is HTTP and where it fits</h2>
<p>TCP and UPD protocols are decide how data is delivered. TCP and UPD protocols do not decode what is the data? How a website will work ? How can page is delayed? For answer these questions HTTP(Hyper text Protocol). It only cares about the content of the data not for transferring and connection.</p>
<p>Browser asks for the page of the particular website and server replies with the HTML, images or any form of data.</p>
<h2 id="heading-relationship-between-tcp-and-http">Relationship between TCP and HTTP</h2>
<p>The TCP and HTTP are work together but each follow different set of rules and roles. HTTP tells how a website asks for data and how the server sends it back, like when a browser asks for a web page and the server replies. TCP gives a safe and reliable path for this data to travel. It makes sure the data reaches properly, in correct order, and without missing anything. HTTP itself does not take care of data safety, so it runs on top of TCP and depends on TCP.</p>
]]></content:encoded></item></channel></rss>