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:
Advantages of TCP:
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.