Understanding TCP vs UDP
Internet requires rules so that the data packages are not delivered to wrong addresses and/or to handle failures. Two of the major rules are TCP and UDP.TCP stands fro transmission control protocol and UDP stands for user datagram protocol are the internet protocols.
image: NordVPN
TCP: data transfer in form of packets → assigns a number → when received, the data is arranged on the basis of the numbering.
TCP ensures accurate and ordered data delivery. Take TCP as a courier delivery which requires address to deliver the parcel.
TCP can be used for web browsing, APIs, emails, etc. In cases if a single byte is missing or data arrives out of order, TCP would prefer to deliver data in a perfect manner and no disruption is faced by the user.
UDP: out of order data transfer and irregular although it is fast but data can be lost too. Take UDP as a loudspeaker, it would deliver the message fast but not perfectly. UDP can be used in cases of live streaming, online gaming, etc. where speed matters more than quality. The next data packet will arrive quickly and the user will barely notice.
What is HTTP?
HTTP (hypertext transfer protocol) defines how web will transmit data such as HTML, text, images or videos.
There is something called client-server architecture where HTTP/HTTPS play an important role. Client side would be our laptops, mobiles, or any device connected to the internet while the server side would provide with the resources to the clients. So here the client sends a request to the server which then responds with the content . Then the data comes in the form of HTTP or HTTPS.
HTTP and TCP actually work together, since TCP provides with a reliable data delivery and HTTP defines how web browsers and servers structure requests, this can be said that HTTP uses the underlying mechanism of the TCP to actually send data and that HTTP is build on TCP. In simpler languages, TCP is the truck that delivers parcel and HTTP is the letter format inside the parcel. TCP is still required when we have HTTP because if data is lost, HTTP cannot handle it nor become a reliable transport measure for data packages.
Many people think that HTTP = TCP, but that is not true. TCP is a transfer protocol while HTTP can be called as an application protocol. They are used to solve different problems.