Using OpenVPN with TCP vs. UDP – Knowing the Difference

Very often with a good VPN service, you will have the option to use TCP (Transmission Control Protocol) or UDP (User Datagram Protocol) mode for your connection. Furthermore any provider that uses the industry standard ‘OpenVPN’ will have the option to switch between both protocols. The problem is most people have a hard time understanding all this networking jargon. But, there’s no need to feel intimidated, we will go over both and once you have an explanation of what each one does, you will be able to better utilize it for your future connections.
Both offer very specific strengths and generally speaking, TCP will almost always be used over UDP, however, nowadays, there are plenty of reasons to take advantage of using a UDP connection with your VPN service. First we will go over a very basic understanding of how data traffic (network packets) travels over the internet and we will follow up by going over both TCP and UDP to quickly explain how both protocols work, and everything will start making more sense.
Network Data Packets – Brief Explanation
So, what we want to quickly convey, is how files and data is sent from say Netflix to your computer. The internet uses a data packet-switching network. The way it works, is say you have a movie that is 700 Megabytes, to send you that large amount of data over long distance, it will cut that large file into thousands of tiny ‘packets’ that range from 7 to 65,000 bytes of data. So, pretty much it slices everything down to tiny amounts of data that can quickly be sent from a Netflix server all the way to your router and computer network card to be downloaded.
Each little packet containing a small part of the large file, have something called a wrapper, which is a tag of information that contains the sender’s IP address (source), the receiver’s IP address (destination) as well as information on exactly where this packet fits in the puzzle. You can imagine if thousands of pieces of a puzzle need to be put together, the system better have an efficient way of doing so. That is the wrapper’s job, it knows exactly which piece of data it holds and how to fit it back with the others. These packets can be in TCP format or UDP and both have important differences how the packets are treated.
These little packets are sent off into the world wide web and travel through various network computers to finally arrive to your router, or not. Some of the packets crash and drop and never arrive while others arrive damaged and need to be resent. This is where TCP and UDP come into play and how they individually operate.
TCP (Transmission Control Protocol)
This is the most used type of protocol in networking because it is the most reliable and usually the better fit for most online applications. When a TCP packet is sent, the receiving router will send an ACK (Acknowledgement) packet back to the sender to advise that it arrived. If the packet never arrives, no response is sent and the source will send it once more until it gets acknowledged by the receiver. If a packet arrives damaged or corrupt, missing some data or what not, it will not acknowledge receiving it, therefore the sending source will keep sending it ensuring that you get all the data packets.
Basically, TCP packets have error protection and ensure you don’t constantly get corrupted downloads. It scans all the incoming data and pieces it together perfectly. TCP is known as a ‘stateful’ protocol because of its automatic error correction. It is the most widely used as it is the best way to download files, websites, pictures, music, whatever it may be, you would want to make sure that it’s not missing tiny bits of data, rendering it corrupt and unreadable. Therefore TCP is used for most network systems. Without a system like the TCP protocol, most of your downloads would fail as packet drops are inevitable.
Using TCP with OpenVPN Pros:
- TCP is the most reliable for data transfers with its AKC packet reply and confirm acknowledgement system, ensuring you get every bit of data needed to be sent. Some VPN services work differently to remove the AKC system for more secure options, but operate in a similar way.
- TCP is the most compatible protocol available will always work on all standard ports without requiring any router configuration.
Using TCP with OpenVPN Cons:
- TCP connections are slower than UDP, they verify every little packet of data to ensure nothing is missed and can cause slow data flow if the source of the data has a long way to travel.
- Can cause unwanted gaming lag and streaming lag. Because of TCP packet error correction, if packets are missing or corrupt and get send over and over, this will cause what is known as game lag. The display will jam or slowdown and the same can happen with streaming video.
UDP (User Datagram Protocol)
UDP is known as a ‘stateless’ protocol as it does not do any data packet verification or acknowledgement. Unlike TCP, instead of verifying and sending a reply to the source that it has been received, the sending party does not expect to receive any acknowledgement in return, and only sends the data packet once, and whether it makes it or not is of no concern. Inevitably, some packets will not make it.
So why use UDP? Well, because it does not carry the burden of packet acknowledgement, it runs much faster. It works with a fire and forget mentality, sending off the data quickly. So it’s faster but less reliable, what is it good for? As technology advanced, the need for UDP became more apparent. Let’s start with VOIP, when packet loss happens on VOIP, you get a loop of the last few words spoken until data packets are back in order, same for TV over IP that most people now have in their homes as well as streaming services like Hulu and Netflix. Without UDP, lost packets would cause image looping and in gaming it can cause bad lag.
When using VOIP, TV Streaming, video games and some P2P applications, it’s better just to let the lost packets be lost for two main reasons. One is speed, UDP will allow streaming applications to operate at their best since the data flows very quickly. Second is that instead of getting an annoying loop or seeing your video skip back a few seconds, the voice over the phone or the image on the screen will simply drop or appear glitch, but without interrupting the action. If you are a hard-core gamer, you will understand how important this can be.
Using UDP with OpenVPN Pros:
- One of the main reasons UDP is very popular on VPN services, is that a VPN connection will often slow down your bandwidth speed. Using UDP really helps alleviate and sometimes remove all bottlenecking caused from the VPN server, providing you the fastest possible speeds over VPN.
- Much Better for many applications that require a constant stream of uninterrupted data flow such as VOIP (Voice Over IP), Television over IP, Video + Audio Streaming and Gaming.
Using UDP with OpenVPN Cons:
- Less reliable for data that needs to be complete. For downloading files that you wish to keep saved. Since UDP does not confirm data delivery, you may end up with corrupt downloads from time to time. With that said OpenVPN does a good job at handling UDP.
If you have any questions, please share them below in the comments for community discussion.
Hi, I know this article is a little old but I can’t find any info about switching to TCP as my OpenVPN is set to UDP which doesn’t work well with my works WiFi.
Any info on how to do this?
Cheers.
Can you describe your setup exactly?
Does this mean if I am downloading P2P I must engage either TCP or UPD over my OPENVPN?
example downloading a episode of Game of Thrones from a torrenting site using a VPN like NordVPN.
I’ve probably got this wrong first time studying VPN language
TCP would be best as it will ensure that none of your downloads end up corrupted or missing packets. UDP is better suited for streaming media, or playing games. Nowadays, many clients automatically assign the correct protocol for you depending on application being used.