TCP VS UDP (Communication Protocols)

TCP VS UDP (Communication Protocols)

Table of contents

No heading

No headings in the article.

Blog on TCP vs UDP

Hey everyone, I am going to start a series of writing blogs on backend-related topics, which will help me to gain knowledge around the backend and will strengthen my foundation. The main purpose of writing is to clarify what I think and the way I grasp knowledge. So let's first see what topics I'm going to learn.

  1. TCP vs UDP

  2. HTTP/http1.1/http2/HTTPS

  3. Web server

  4. TLS

  5. NAT

  6. Proxy and Reverse Proxy

  7. ACID Properties in RDBMS

  8. Pub-Sub Architecture

  9. Database Indexing

... and much more

Let's first cover the first part

  1. TCP vs UDP

TCP and UDP are the protocols used to transfer data in a network, now you are a little confused about what the heck protocol is ?? basically, protocols are the standard rules that must be followed during any data transfer.

ok now you understand what protocol is and TCP and UDP are those. TCP stands for Transmission control protocol, before transmitting the data TCP does a 3-way handshaking to create a connection between the server.

3 way handshaking in TCP

Let's have a look at what advantages TCP gives us:

  1. Acknowledgement: When you deliver something you must want to know whether is it delivered or not, so in the case of TCP it is there.

  2. Guarantee Delivery: There is a guaranteed delivery of packets

  3. Connection Based: A connection is created before transmitting the Data, it's a 3-way handshaking algorithm.

  4. Ordered Packets: The order in which the packets are sent the server will receive the packet in that order only.

  5. Congestion Control : Controlling the traffic and managing it

Now let's discuss some of the disadvantages

  1. Larger packets:

  2. Slower than UDP:

  3. Stateful

  4. Server memory

  5. A limited number of Connections

Applications of TCP

  1. HTTP uses TCP to transmit data in a network

  2. Databases use TCP

  3. SMTP used TCP

  4. FTP used TCP

UDP stands for User Datagram protocol, it is fast as compared to TCP as it doesn't have that overhead for the larger headers.You can understand about it when we discuss it advantages and disadvantages as compared with TCP

Advantages:

  1. Smaller packets:

  2. Stateless

  3. Fast

Disadvantages:

  1. No Acknowledgement

  2. No Guarantee Delivery

  3. Connection less

  4. No order Packets

Applications of UDP

  1. Video Conferencing

  2. Online games

  3. DNS uses UDP to fetch IP addresses

Thank you for reading this article!

If you enjoyed this article and want to learn more about Javascript, follow me on LinkedIn at Himanshu Singh, where I post regular updates.