TCP vs UDP
suppose you have to send data to your friend in whatsapp so how you send using internet ,
suppose you send data and the message which your friend recived is different or missing letters,
or there is no data ,time ,location,also if your data reach other person ,so how you resolve this
situations.
for that you need some rules to how data will be transfer one device to other for that this protocal
come in picture called TCP and UDP
TCP:
tcp stands for Transmission Control Protocol its an relaiable, ordered, error-checked delivery of data packets.
UDP:
udp stands for User Datagram protocol its not relaible as compaire to tcp , but its fast .
when to use tcp:
tcp used when the priorty is not speed ,its usally use for while creating financial websites, chatting like application where each and every data is important .
when to use Udp:
udp is used when we dont focuse on relaiblity we just want speed .like streaming platforms,video calling apps etc.
HTTP
http is protocall build top on tcp ,http stands for hypertext tranfer protocall ,its used to communicated
overthe web browser to communicate webserver .
Relationship between TCP and HTTP
HTTP relies on TCP to send and receive data reliably
When you type a URL in a browser:
The browser uses HTTP to formulate a request (GET, POST, etc.)
This HTTP request is sent over TCP, which ensures all the data reaches the server without loss and in correct order.
The server responds with HTTP data (HTML, JSON, etc.) over the same TCP connection.
TCP handles:
Segmentation of data
Reliable delivery (retransmission of lost segments)
Ordering
Error checking
HTTP handles:
Meaning of the request (e.g., GET /index.html)
Status codes (e.g., 200 OK, 404 Not Found)
Content formatting and headers
Think of TCP as the postal service ensuring the letters arrive safely, in order, and without damage.
HTTP is the letter itself, containing the message, request, or instructions.