<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Shubh Ujala</title>
    <description>The latest articles on DEV Community by Shubh Ujala (@shubh_ujala).</description>
    <link>https://dev.to/shubh_ujala</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3744893%2Fb191502b-2024-4c6d-9c2a-ddcda5722a4f.jpg</url>
      <title>DEV Community: Shubh Ujala</title>
      <link>https://dev.to/shubh_ujala</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shubh_ujala"/>
    <language>en</language>
    <item>
      <title>CSS Selectors 101: Targeting Elements with Precision</title>
      <dc:creator>Shubh Ujala</dc:creator>
      <pubDate>Sun, 01 Feb 2026 13:01:20 +0000</pubDate>
      <link>https://dev.to/shubh_ujala/css-selectors-101-targeting-elements-with-precision-2che</link>
      <guid>https://dev.to/shubh_ujala/css-selectors-101-targeting-elements-with-precision-2che</guid>
      <description>&lt;p&gt;First of all let's discuss why do we need CSS?&lt;br&gt;
Just take a simple example , let say you have created a navbar using HTML and you have added all the functionalities in it but without CSS this is how your navbar will looks like will looks like&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fktd4rd5ow731nwa2t7cg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fktd4rd5ow731nwa2t7cg.png" alt="before-CSS" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;from any angle is it looks like nav bar? NO, right now let's apply some CSS in it&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3hth63h5m9530yab2o4z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3hth63h5m9530yab2o4z.png" alt="after-CSS" width="800" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now see which feels more engaging , obiously second one means after applying CSS, that's why we need CSS to style the webpages.&lt;/p&gt;
&lt;h2&gt;
  
  
  Now let's discuss the technical definition of CSS
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;CSS stands for &lt;u&gt;Cascading Style Sheets&lt;/u&gt;, here Cascading term means overriding, this is exactly what we are doing
We are overriding the default properties of HTML tags given by browser, and Yes we do have special name for the styling given by browser which is known as &lt;u&gt;User Agent Style.&lt;/u&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  How to give styles in CSS
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;We are giving styling in CSS using selectors.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  What are Selectors?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Selectors name itself is defining it's definition, basically it is used to select the elements to give styling to them, there are mainly 4 ways to select the element : &lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  1. &lt;u&gt;Element Selector&lt;/u&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;with the help of element selector , we can target a particular element by using HTML tag and apply the styling in that particular element also we can also apply the styling to it's child element let see how :&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiia6ifp0akf1yet1ltvh.png" alt="element selecor" width="800" height="275"&gt;
Here you can see in HTML file , we have a &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt; tag and we have applied the styling to nav tag, so this is how using element selector we can apply the styling.
Also We can also apply the stylings to the child elements of any tag using element tag&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F32zs0cks0434fcx4ea7n.png" alt="Child-styling" width="800" height="286"&gt;
Here you can see we have two child elements &lt;code&gt;&amp;lt;h3&amp;gt; &amp;lt;h4&amp;gt;&lt;/code&gt; of &lt;code&gt;nav&lt;/code&gt; so this is how we are able to apply the stylings to the child element using element tag.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Where it fails?&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
    When we have multiple same elements inside the parent elements and we don't want to apply the stylings to all elements , this is where it fails &lt;br&gt;
   Example : &lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F73z3pe2p4rvzhb2179wq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F73z3pe2p4rvzhb2179wq.png" alt="name-selector" width="800" height="328"&gt;&lt;/a&gt;&lt;br&gt;
   Here you can see we want different styles for each child of &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt; element but by using the element tag we are unable to do that.&lt;/p&gt;
&lt;h3&gt;
  
  
  2. &lt;u&gt;Class Selectors&lt;/u&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Earlier , using element tag we were not able to give the different styling when we have multiple childs , so class selectors solves this problem for us, basically we have to give different classes to our HTML tag and by using class selectors we can apply different styling for each tags. Let' implement it practically &lt;/li&gt;
&lt;li&gt;Syntax to use class selector, We have to use dot(.) in front of the class name and then apply styling , you can refer the example's syntax below &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1lwoue2nalmvhtpuxx3x.png" alt="class-selector" width="800" height="309"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Also we can give multiple class names to tag seperated by spaces like this &lt;code&gt;class = "main div1"&lt;/code&gt;, and the corresponding styles that we have given is going to applied.&lt;/p&gt;
&lt;h3&gt;
  
  
  3. &lt;u&gt;ID Selectors&lt;/u&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;It is another way to target HTML tags to give styling, an ID is used to uniquelly identify any tag so it is generally recommneded to use different id names for multiple tags, you can use same names as well there is no issue with that also.&lt;/li&gt;
&lt;li&gt;Syntax to use ID selectos, We have to use &lt;code&gt;#&lt;/code&gt; before the name of id , refer the below example's syntax&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0bzgsskww87p1q13z7mh.png" alt="ID-selectors" width="800" height="315"&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  4. &lt;u&gt;Universal Selector&lt;/u&gt; (*)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;With the help of universal selectors we can apply the styling to the entire documents, Syntax to use universal selector &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F55ka2knioeno3l3xgzwh.png" alt="Universal Selector" width="800" height="177"&gt;
Example :&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0w116est646qddsatdcq.png" alt="Universal Selector" width="800" height="274"&gt;
Here you can see I haven't targeted any particular element instead i have just written (*) and apply the styling and it is getting applied on the whole document this is how universal selectors works.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  &lt;u&gt;Grouping CSS selectors&lt;/u&gt;
&lt;/h3&gt;

&lt;p&gt;By grouping means, if we want to apply the same styling to the different elements so without grouping we have to write is again and again but with the help of grouping we just have to write it once and done, CSS is going to be applied on all the different elements.&lt;/p&gt;

&lt;p&gt;Now let's see the syntax for grouping the element in CSS&lt;br&gt;
We have to use it like this (refer images)&lt;br&gt;
Examples : &lt;br&gt;
 1. using element tags only&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmj97o0jve7fw6qg93tv2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmj97o0jve7fw6qg93tv2.png" alt="example-1" width="800" height="208"&gt;&lt;/a&gt;&lt;br&gt;
 2. when we have classes and id's with element (generally we have it) then this is how it should be done. &lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyw7v4we7lwzvbf3fsvg4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyw7v4we7lwzvbf3fsvg4.png" alt="example-2" width="800" height="280"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;u&gt;Descendant CSS selectors&lt;/u&gt;
&lt;/h3&gt;

&lt;p&gt;By decendent selector means, We are giving styles to the elements which are present inside other elements &lt;br&gt;
Example : &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvu78ckhwk5xg03l7pz23.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvu78ckhwk5xg03l7pz23.png" alt="decendent-selector" width="800" height="268"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the above example we are targetting the h2 tag whose path is like this &lt;/p&gt;

&lt;p&gt;&lt;code&gt;Main -&amp;gt; div -&amp;gt; h2&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;that's why while using decendant selector we have used &lt;code&gt;main div h2&lt;/code&gt; means we have to go to the main tag inside that we have to go to div and inside div finnaly we have to style h2&lt;/p&gt;

&lt;p&gt;So this is how it works in CSS.&lt;/p&gt;
&lt;h2&gt;
  
  
  Basic selector pripority in CSS
&lt;/h2&gt;

&lt;p&gt;As we have discussed the way of styling the element in CSS, so there is one question suppose we have applied the styling to using (*) universal selectors&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; * {
    color: yellow;
   }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and also we have one div in which some text is there and in the div also we have applied the styling like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; .div{
    color : red;
 }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then what should be the color of the content in the div? will it be yellow or black?&lt;br&gt;
let see : &lt;br&gt;
In this example we have used universal selector to give text-color&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fke0lrn0iixvsy5i9rpe4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fke0lrn0iixvsy5i9rpe4.png" alt="before" width="800" height="254"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But ass soon as we have given the styling using class selector it's color changes from yellow to red.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxkx646zhh59co0203ov5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxkx646zhh59co0203ov5.png" alt="After" width="800" height="281"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;let's add one id to it and let's again try to change the text color using id selector&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9tzi3conb0m1fjqxltqh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9tzi3conb0m1fjqxltqh.png" alt="id" width="800" height="328"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's crazy now it is showing pink color , means id is having more priority than class selectors , and class is having more priority than universal , means there must be a priority in CSS.&lt;/p&gt;

&lt;p&gt;here is the priority list &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4f94mvhq5np3095ar6nl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4f94mvhq5np3095ar6nl.png" alt="priority" width="660" height="359"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;[ref of image : GeekForGeeks]&lt;/p&gt;




&lt;p&gt;Hope you enjoyed reading.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>css</category>
    </item>
    <item>
      <title>TCP vs UDP: When to Use What, and How TCP Relates to HTTP</title>
      <dc:creator>Shubh Ujala</dc:creator>
      <pubDate>Sun, 01 Feb 2026 07:48:49 +0000</pubDate>
      <link>https://dev.to/shubh_ujala/tcp-vs-udp-when-to-use-what-and-how-tcp-relates-to-http-545j</link>
      <guid>https://dev.to/shubh_ujala/tcp-vs-udp-when-to-use-what-and-how-tcp-relates-to-http-545j</guid>
      <description>&lt;p&gt;In this blog we are going to talk about the protocols. you must be wondering what exactly is protocols?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;protocols is nothing but just a fancy name of rules.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In simpler terms, Protocol is a set of some agreed rules based on that two system communicate with each other. without these rules we can’t communicate reliably.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why we need protocols?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Because without these rules or protocols internet don’t know where or whom to send the data. these protocols help us to address the reciever and sender so the communication between them can be as smooth as possible without worring about the reliablility&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  TCP (Transmission-Control-Protocol)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;it is a protocol that allows devices to communicat reliably over a network. it ensures that data reaches the destination correctly ans in the right order, even if part of the network are slow or less reliable.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;TCP establishes a logical connection between the sender and receiver before data transmission begins.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It ensures that data is delivered accurately and in the same order in which it was sent using acknowledgements and sequence numbers.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before sending any data it establishes a connection between sender and reciever for secure and reliable data transfer and the process that is used by it is called &lt;strong&gt;3-Way handshake&lt;/strong&gt; and also the proccess which it used to terminate the connection is known as &lt;strong&gt;4-Way handshake&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F12of9vqjjottoaii5bpg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F12of9vqjjottoaii5bpg.png" alt="3-way handshaking process" width="800" height="222"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How TCP works?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;3-Way Handshake&lt;/strong&gt; → Before sending any data TCP establishedd a connection between client and server for secure and reliable data transfer.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Segmenting&lt;/strong&gt; → When an application sends data (like an email) , TCP breaks that data into small chunks called segments. this makes it easier to send large amount of data over the network reliably, Each segment has &lt;u&gt;header&lt;/u&gt; containing information like sequence number, ports and flags. it looks like this:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpz7ymgiijmc4k390k0wu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpz7ymgiijmc4k390k0wu.png" alt="TCP- headers" width="800" height="311"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Routing via IP&lt;/strong&gt; → once TCP creates segments of data they are handed to IP and IP is responsible for delievering the segments from the client to the server.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Acknowladgments (ACKs)&lt;/strong&gt; → the reciever(client) sends an ACKs for every segment and this tells the sender that data has arrived safely , Suppose if ACKs is not revieved , TCP assumes that the segment was lost and triggers retransmission.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Retransmission&lt;/strong&gt; → if sender doesnt recieve an acknowledgment within a certain time then it resends the missing segment, This ensures no data is lost making TCP reliable.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Flow &amp;amp; Error Control&lt;/strong&gt; →&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;Flow Control&lt;/u&gt; : TCP prevents the sender from sending too much                 data too quickly for the server to handle.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;Error Control&lt;/u&gt; :TCP checks for corrupt segment using checksums and request transmission if needed.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Together, these mechanisms ensure data is delivered reliably and efficiently, without overloading the network or the receiver&lt;/p&gt;

&lt;h2&gt;
  
  
  UDP (User-Datagram-Protocol)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;UDP is a protocol that provides fast, connectionless and lightweight communication between processes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;it doesn’t guarantee delivery, order or error checking making it suitable for real-time and time-sensitive application such as video streaming,audio call, gaming or live streaming.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxivm228bsf4aea87neu0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxivm228bsf4aea87neu0.png" alt="UDP-working" width="800" height="207"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;UDP Header&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4myx176nmkra4om4ly2d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4myx176nmkra4om4ly2d.png" alt="UDP-Headers" width="800" height="272"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How TCP and UDP are different from each other
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbbr73m68b3vdp58s9acx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbbr73m68b3vdp58s9acx.png" alt="TCPvsUDP" width="800" height="382"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  When to use TCP?
&lt;/h3&gt;

&lt;p&gt;TCP can be used in the following scenarios&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;Text Communication&lt;/u&gt; → We know we cannot tolerate any discrepeancy in texting between sender and reciever. Hence we have to use the protocol which is reliable that’s why we prefer TCP.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;Transfer of files or FTP&lt;/u&gt; → TCP is used in File transfer when we cannot tolerate the loss of data and receiving the data incorrect order is of utmost importance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;HyperText Transfer Protocol&lt;/u&gt; → Since TCP provides use inorder data, error control and flow control that why it is prefer while accessing the web pages.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  When to use UDP?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;Real-Time Application&lt;/u&gt; → Because UDP reduces the latency , which is crucial for real-time application such as video streaming or online gaming&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;Broadcast and Multicast Transmission&lt;/u&gt; → it supports broadcast and multicast sending capabbilities inherently, allowing information to be sent to multiple recievers easily and quickly, useful in the scenarios like updating live statistics on a sports website.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;High-Speed Data Transfer&lt;/u&gt; → UDP is suitable for scenarios where the volume of data is enormous, and retransmission overhead is not acceptable, such as in certain file transfer applications.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Real World Analogy TCP vs UDP
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;TCP : Courier Service&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Imagine you send important document using courier service , then what happens? you get a tracing number, the reciever must have to sign after delievery, if page is missing then it is resent, page arrive in correct order.&lt;/p&gt;

&lt;p&gt;this whole process exactly explains how TCP works.&lt;/p&gt;

&lt;p&gt;Now Imagine it like this :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Courier recepit → TCP acknowledgment&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Re-sending lost pages → Retransmission&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Proper order → Sequencing&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;→ TCP used when accuracy matters more than speed&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;UDP : Phone call&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Imagine you are talking on a phone call , then what happenens? if you missed a word then speaker dosen’t repeat, conversation continues wihtout waiting , speed matters more than perfection&lt;/p&gt;

&lt;p&gt;This is how UDP works.&lt;/p&gt;

&lt;p&gt;Now Imagine it like this :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;No conformation → No acknowledgment&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Missed word → lost packets&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Real-time flow → low latency&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;→ UDP used when speed matters more than accuracy&lt;/p&gt;

&lt;h2&gt;
  
  
  What is HTTP and where it fits
&lt;/h2&gt;

&lt;p&gt;HTTP (Hypertext Transfer Protocol) is a core internet protocol that defines how data is exchangesd between client and server on the web.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enables communication between web browsers and web servers&lt;/li&gt;
&lt;li&gt;forms the foundation of data transfer on the World wide web.&lt;/li&gt;
&lt;li&gt;Defines rules for requesting and delivering data between system&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foz6e5tn7no256kts7yz3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foz6e5tn7no256kts7yz3.png" alt="HTTP-Connection" width="800" height="198"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;[ref of image : GeekforGeeks]&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt; : it is an application-layer protocol used implicitly by web browser to transfer text, images and multimedia accross distributed , hypermedia-based web systems.&lt;/p&gt;

&lt;h3&gt;
  
  
  Common confusions →
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Are HTTP and TCP same?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Answer is No, TCP is transport layer protocol which is responsible for reliable data delievry , ensuring data packets arrive in order, without packet loss. whereas HTTP is an application layer protocol , it defines how web data is requested and sent such as web pages, forms and APIs&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;infact HTTP depends on TCP. because HTTP uses TCP to safely send it’s request and response but it does not handle reliability itself.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In simpler terms TCP handles how data travels , while HTTP handles what the data means&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Are they work on the same layer?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Answer is again No. TCP works on transport layer where as HTTP works on Application layer&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Relationship between TCP and HTTP →
&lt;/h3&gt;

&lt;p&gt;As we know TCP and HTTP both works on different layers , and we also know that HTTP requires TCP , then the main question arises is How they interact?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;So, TCP first creates a reliable connection between client and server then HTTP sends request and responses through that TCP connection, while TCP ensure that HTTP data is delievered safely and completely&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;HTTP relies on TCP for reliable communication while TCP does not understand or depend on HTTP&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is the Core relaionship between TCP and HTTP.&lt;br&gt;
&lt;/p&gt;


&lt;p&gt;Hope you enjoyed reading ❤️&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>computerscience</category>
      <category>networking</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
