# TCP, UDP, and HTTP

When data moves on the internet, it doesn’t move randomly.  
There are **rules** that decide **how data is sent**, **how fast**, and **how safely**.

These rules are called **protocols**.

Think of protocols as **agreements**:

> “This is how we send data. Follow these rules.”

## Why the Internet Needs Rules at All

Imagine sending a parcel without:

* Address
    
* Tracking
    
* Delivery confirmation
    

Chaos, right?

Same with the internet.  
To send data properly, computers need rules.

Two important protocol are to send a data

* **TCP**
    
* **UDP**
    

## What is TCP ?

TCP stands for Transmission Control Protocol its ensure that whatever data is send make it all the packet which is transfer safe and complete TCP make sure nothing is lose..

What TCP does:

* Sends data in order
    
* Checks if data is received
    
* Resends missing data
    
* Makes sure nothing is lost
    

TCP is more Reliable and Its slow also because its doing 3 way handshake

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1770443368186/d5f1dc6a-7d89-4fbf-82f4-b307fda27142.png align="center")

## What is UDP?

UDP Stand for User Datagram Protocol

UDP is used when **speed matters more than accuracy**.

What UDP does:

* Sends data fast
    
* Does NOT check if data arrived
    
* Does NOT resend missing data
    
      
    **Simple example:**  
    Live announcement on Viedo calling App.  
    If you miss it, it’s gone.
    
    UDP is **fast but not reliable**.
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1770444146972/8323617f-bd27-4f01-a7c7-f09acba35f5b.png align="center")

## Key Differences Between TCP and UDP

| TCP | UDP |
| --- | --- |
| Reliable | Not reliable |
| Slower | Faster |
| Checks delivery | No delivery check |
| Resends data | No resend |
| Ordered data | No order guarantee |

## What is HTTP?

Now comes the confusion part for beginners.

**HTTP is NOT TCP.**

HTTP is a **higher-level rule**.

**HTTP decides:**

* How request looks
    
* How response looks
    
* Status codes (200, 404, 500)
    
* Headers and body
    

**HTTP does NOT send data itself.**

## Relationship Between HTTP and TCP

Think like this:

* **TCP** → how data is transported
    
* **HTTP** → what the data means
    

**HTTP runs on top of TCP**

HTTP says:

> “Send a GET request for `/login`”

TCP says:

> “Okay, I’ll deliver it safely.”

## Why HTTP Does Not Replace TCP

HTTP:

* Does not guarantee delivery
    
* Does not handle packet loss
    
* Does not manage connections
    

So HTTP **needs TCP** to work.

Without TCP:

* HTTP messages could break
    
* Data could be lost
    
* Websites would fail
