TCP vs UDP: Protocols, Ports, and Practical Applications

Posted on Dec 17, 2018 by Kristin Hassel

When and how to use protocols, and with which ports, can be extremely confusing if you aren’t tech-savvy. Luckily, most apps and online services are preset to use certain protocols already. Some apps, like VoIP services, establish connections with TCP, but use UDP to transfer communications. Others, like VPNs, give you an option of which protocol and port you’d like to use. 

Either way, all the choices can be confusing. So, it’s important to know the basics before making any configurations to an app’s default settings. Both protocols have their strong points, whether you go with the reliability and stability of TCP, or the speed and efficiency of UDP. Our guide is here to ensure you make the right choice for you. 

TCP & UDP At A Glance

TCP and UDP are both transport layer protocols. The transport layer controls all point-to-point communications in a standard open systems interconnection (OSI) model, which contains the 7 layers required for technological devices to communicate effectively over a network. 

I won’t get too technical. Let’s take a look at the basics before we dive into definitions and details. 

TCP & UDP Basics
Comunication Method Overhead Header Length Use Examples Stream Type
TCP Host-to-Host Low 20-60 Bytes Variable HTTPS, HTTP, FTP, & Telenet Byte
UDP Process-to-Process Very Low 8 Bytes Fixed DNS, VOIP, DHCP & SMTP Message

Advantages and Disadvantages of TCP 

Transmission control protocol (TCP) is a host-to-host connection-based protocol, so it needs an established connection before it can transmit data. For the protocol to work, it must create, maintain, and close a connection. Once a source transmits a packet, the destination device must confirm receipt before any additional packets are sent. 

TCP protocols use in-depth error-checking methods to provide flow and congestion control. Byte streams help maintain sequence order, and the use of data sequencing allows you to retransmit lost packets before the next packet is sent. 

Longer header lengths and error-checking and acknowledgement requirements make TCP a bit heavier than UDP. The upside is it means reliable, secure communications. It never sends your data to the wrong destination or leaves your connection open.

UDP Pros and Cons

User datagram protocol (UDP) is a communications-based protocol and operates process-to-process, so it isn’t reliant on connection agreements and doesn’t require packet acknowledgement. This protocol can send data packets before the destination device agrees, and can continue to send them one after another without confirmed delivery. It doesn’t rely on opening, maintaining, or closing connections, and error-checking isn’t required. UDP only performs basic checksums for error-checking if any.

UDP has a significantly lower overhead and a fixed header length, making it faster and more efficient than TCP. Its lightweight transmissions are excellent for situations where transmission speed trumps accuracy. It’s also bandwidth intensive to endure packet loss and readily supports broadcast and multicast transmissions.

Protocols vs Ports

Ports are the channels used for communications, while protocols determine how those communications take place. Basically, ports are the river, and protocols are the vessel you use to navigate it. Both TCP and UDP ports provide data security, but TCP offers greater structure and reliability, while UDP offers speed and efficiency.

Other protocols can also be used with TCP and UDP ports, including OpenVPN, WireGuard®, HTTP, and SMTP. For instance, PIA uses OpenVPN over UDP by default. We also offer TCP to provide flexibility, so you can switch between the two whenever you like.

TCP & UDP: What’s the Difference?

The main difference between TCP and UDP is reliability. UDP is fast and efficient, but transmissions aren’t always reliable. In the diagram below, you can see how TCP and UDP packet transmission between the source (sender) and destination (receiver) varies

TCP relies on communication throughout transmission, UDP does not.

TCP’s system of checks and balances guarantees packets are sent to the right destination, in the right order, and undamaged. If one is lost, it’s easy to retransmit. 

UDP continues to deliver packets regardless of errors. If the packet is lost, it can’t be resent, and other packets in the transmission can still arrive out of sequence. Duplicate packets, out-of-sequence packets, and lost packets are all issues you face with UDP.

Despite its very organized structure, TCP offers no clear distinction between protocols, services, and interfaces. This makes it extremely difficult to replace protocols in TCP, in comparison to UDP. UDP also leaves more room for errors during transmissions, making it less reliable than TCP. 

Here’s an example of the difference between TCP and UDP as illustrated by a real-world application.

Sceneario Jeff gets an awesome new dog named Beans, and he immediately takes him to the vet to get a microchip implanted. One day Beans bursts out the gate before Jeff can catch him. He looks all over the neighborhood for hours but can’t find him, so he decides to call the local pound just in case.

TCP Jeff calls the pound and describes Beans. They realize they have Beans and scan him for a microchip. They ask Jeff to confirm his information. Once he confirms his name and address, they tell him to come pick up Beans. Jeff produces proof of identity at the pound, picks up Beans and they go home.

UDP 1 Jeff calls the pound, and they scan a new arrival for a microchip; it’s Beans. Jeff picks him up.

UDP 2 Jeff calls the local pound only to find out they adopted Beans to an interested family already.

UDP 3 Jeff calls the pound, but when they scan Beans, the microchip malfunctions



In the TCP example, the communication process provides details and carries out actions in an orderly sequence to reach the correct result. On the other hand, UDP can have multiple solutions, and while the first example is faster and gives us the same result as the TCP solution, it doesn’t prevent errors. Anyone can say they are Jeff and pick up Beans, the pound could forgo scanning for a microchip, or the microchip could malfunction. 

When to Use TCP vs UDP

Services requiring a client and server to send packets simultaneously work better with TCP, as it helps enable a network’s total bandwidth. Use TCP when a small delay is okay, and you need to focus on reliability over speed. Examples of applications using TCP are Instagram and most email services. Video services like Netflix and YouTube also use it to maintain data integrity.

UDP is best when the client and server send packets independently and applications are time-sensitive. Since there are no retransmission delays, it works well for (most) RPG games, as well as for DNS and VOIP services like Zoom, which require fast speeds.

Some services combine both protocols for a fast, reliable solution. For example, Skype uses TCP for signaling and UDP/TCP for traffic transport.

Which Protocol is Best?

The answer isn’t as simple as TCP or UDP – it depends on what you’re doing. TCP is excellent for secure email, sensitive account access, and browsing because it offers stability and reliability. UDP is best for VOIP services, most streaming applications, and gaming because it’s fast and efficient.

But even these examples aren’t set in concrete. Many streaming services use the TCP protocol, and email services can use UDP. Some services even combine the two. It’s important to weigh the pros and cons before determining which protocol is right for the job at hand.

TCP & UDP Basics
Pros Cons
TCP

✅ Operates independently of OS

✅ Very scalable client-server architecture

✅ End-to-end communications

✅ Guaranteed delivery of data to the correct router

✅ Allos retransmission of lost data packets

✅Easily stabilishes connections between various devices

⛔Protocol replacement

⛔No real separation between services, interfaces and protocols

UDP

✅Multivast & broadcast transmission are possible

✅ Endures packet loss as it’s bandwidth intensive

✅ Lightweight for faster transmissions

✅ Not restricted to connection-based communications

⛔Lack of flow and congestion control

⛔Packets may be lost, duplicated, sent to the wrong router, or delivered out of sequence

An Informed Choice Between TCP & UDP

When you aren’t sure whether to use TCP or UDP, stick with an app’s default transfer protocol and port selection. If you decide to switch it up, this guide provides the information you need to make an informed choice, so you can secure your data communications.

FAQ

What is the difference between TCP and UDP packets?

UDP packets are significantly lighter than TCP packets, so they travel more quickly. You need three TCP packets to form a connection before sending data, while UDP only requires one and isn’t reliant on an established connection. Additionally, UDP packets are sent individually, while TCP packets use byte streams.

WireGuard® only uses UDP, while OpenVPN is compatible with both TCP and UDP. The use of strictly UDP gives WireGuard® a distinct speed advantage over OpenVPN and other protocols, as it doesn’t require an established connection.

Is UDP more reliable than TCP?

No. Overall, TCP is more reliable than UDP — both in terms of protocols and ports. It offers in-depth error-checking and guarantees source data reaches its destination. However, using OpenVPN protocol over a UDP port can increase data security without sacrificing speed. 

PIA allows you to use either TCP or UDP ports and offers OpenVPN and WireGuard® protocols. Choose WireGuard® over UDP for speed, OpenVPN over TCP for maximum security, or mix-and-match based on your needs.

Do streaming services like Netflix use TCP or UDP?

Netflix uses TCP for reliability as a small delay isn’t a big deal, content can be streamed over browsers easily, and it helps lighten server loads. Most streaming services, including Hulu, Amazon Prime Video, and YouTube also use TCP

PIA gives you fast speeds regardless of which protocol the streaming service uses. We use 10 Gbps network cards and offer WireGuard®, for fast reliable streaming connections.

How do I change between UDP and TCP?

You can find most port and protocol settings for computers in your system or security settings. On mobile devices, navigate to the ‘About Phone’ section and check ‘Status’. Not all devices give you the option to change between ports or protocols, though.

It’s fairly easy to change ports in the PIA VPN app. The method for changing your port depends on the device you’re using, but we offer guides for all compatible devices. If you’re unsure, reach out to our friendly Customer Support and we’ll be happy to help.

Does PIA use TCP, UDP, or both?

PIA uses OpenVPN over UDP by default, but you’re welcome to change your protocol and port options at any time. We offer OpenVPN and WireGuard® protocols, as well as IPSec for iOS. You can also choose from several TCP and UDP ports.

VPN Service