UDP vs TCP

Posted by
published
March 17, 2023
TABLE OF CONTENTS

WireGuard uses UDP to transmit data across the world. But just what is UDP?

The internet is like a huge postal system that delivers messages between computers. There are two main ways these messages can be sent: UDP (User Datagram Protocol) and TCP (Transmission Control Protocol). These two methods are like different delivery services for the messages. 

There’s an old adage for services, “fast, cheap, or good. Pick two.” UDP is fast and cheap. Imagine a delivery driver racing to their destinations, speedily tossing each message to the doorstep before moving on. He doesn’t get a signature for his deliveries, and he doesn’t make sure the package stays in tact. He’s just going as fast as he can. Because of this, some messages might not make it, or they might arrive in the wrong order, but in certain situations, speed is more important than accuracy.

TCP, on the other hand, is the reliable delivery service you order when you have something really important to ship, like the old family photos. The driver checks to make sure the package is okay each step of the way, and ensures the packages are delivered when they are supposed to be. And of course, they make sure you’re at home to receive the delivery. This method is much slower, because it takes time to ensure everything is correct, but it guarantees that the messages will be received accurately and in the right sequence.

So, to sum up the two:

Advantages of UDP:

  1. Speed: UDP is faster because it doesn't spend time checking for errors or confirming receipt.
  2. Less Overhead: UDP has less data overhead because it doesn't require extra information for error checking and confirmation.

Advantages of TCP:

  1. Reliable: TCP ensures messages are delivered accurately and in the correct order.
  2. Error Correction: TCP can detect and fix transmission errors, ensuring data integrity.

Ultimately, you have to make a decision on what is more desirable, speed, or reliability? The answer will likely be different depending on the scenario, but you will always need to choose one or the other when deciding between UDP or TCP.

More posts

GET STARTED

A WireGuard® VPN that connects machines securely, wherever they are.
Star us on GitHub
Can we use Cookies?  (see  Privacy Policy).