OpenVPN is a popular open-source software package used for VPN connections. It relies on UDP and TCP protocols for transmitting data across secure VPN tunnels.
UDP and TCP are both transport-layer protocols, required for establishing temporary connections between two programs, computers, or servers.
With VPNs, you may have the choice between UDP and TCP. So which should you use? Both options provide advantages and disadvantages that you need to explore.
What Is the TCP Protocol?
Transmission Control Protocol (TCP) offers host-to-host communication. It provides a standard for sending packets of data between applications, such as a server hosting a website and your computer.
TCP works as a transport layer for the Internet Protocol (IP). When you visit a website, the server uses the HTTP protocol to send the HTML file and additional data to the client. The HTTP protocol uses TCP to establish the connection.
This protocol handles the connection and the sending of data packets. It also uses error correction to determine if the packets arrived correctly without bothering the host application.
The TCP checks for lost packets, out of order packets, and other transmission errors. If it detects any issues, the TCP layer asks the host to resend the packets.
While TCP ensures that data arrives correctly, it offers slower speeds compared to UDP.
What Is the UDP Protocol?
User Datagram Protocol (UDP) provides an alternative to Transmission Control Protocol (TCP). These protocols work on top of the Internet Protocol (IP) so you may also see them listed as UDP/IP and TCP/IP.
While TCP uses host-to-host communication, UDP uses process-to-process communication. UDP sends datagrams instead of individual packets. It also skips the error correction used in TCP connections.
Without the error correction, UDP delivers faster transmissions. It experiences much lower bandwidth latency and overhead. UDP tends to be the preferred choice for applications that require faster speeds, such as voice communication, torrenting, video streaming, and gaming.
Particular Circumstances that Require TCP
For most VPN users, UDP provides the best option for general use. However, there are some potential problems that may keep you from connecting to a VPN with UDP include:
Countries or ISPs blocking UDP ports to prevent VPN connections
Some countries have powerful firewalls to detect the use of VPNs. UDP often uses the same known ports, making it easy to detect the VPN (when connected to UDP).
Additionally, some ISPs monitor traffic for UDP connections. If your ISP detects UDP, they may cap your bandwidth.
Missing data packets causing the VPN connection to drop
Without the error correction, it is possible to lose multiple packets with UDP, especially with a slow Internet connection. When the UDP connection drops multiple packets, the VPN drops your UDP connection. This exposes your IP address and allows your ISP to view your activity.
Slower Internet speeds causing dropped connections
TCP is more stable compared to UDP due to the error correction. You have less of a chance of experiencing a dropped connection when you have intermittent Internet or slower speeds.
Choosing Between UDP and TCP for P2P
Other than the scenarios we mentioned above, UDP remains the preferred choice, especially for an activity that involves a lot of data. If you are torrenting files with a P2P connection, UDP offers the speeds that you need.
Keep in mind that TCP is not terribly slow. You can still browse the web and may even download torrents at relatively decent speeds.
When you first use a VPN service that utilizes OpenVPN, we suggest using UDP. However, if you experience dropped connections or need to bypass a firewall, switch to TCP.