TCP vs UDP: When to Use What, and How TCP Relates to HTTP

1.What are TCP and UDP
Tcp and Udp are protocol used in the transport layer of osi model which is at layer 4.Tcp is connection oriented protocol which first make connection between the client and the server .break the data in the segment and hand over the segment to the ip protocal , from there ip route the segement to the correct destination .udp is connectionless protocal because it does not make connection between the client and the server. it just send data to the destination address.
2.Key differences between TCP and UDP
Tcp
-connecection oriented protocal
-reliable and ordered data delivery
-higher overhead but high accuracy
Udp:
-connectionless and lightweight
-no guarantee of order or delevery
-low overhead and high speed
3.When to use TCP
we use tcp when want the accurate data in the right order. for eg sending the email.
4.When to use UDP
we use the udp when we dont want accurate data and right order but want at high speed.eg:video conferencing
5.What is HTTP and where it fits
HTTP(hypertext transfer protocal) work at the application layer. whenever we send the request, it goes from applocation layer,in the transport layer the tcp and udp comes in the picture




