What Is The Difference Between TCP And UDP?

What Is The Difference Between TCP And UDP?

Updated: 08-10-2021

Most Virtual Private Network (VPN) providers opt for the OpenVPN protocol because it's secure and reliable. The underlying code of OpenVPN is open source, meaning it's accessible to anyone and can be regularly checked for bugs by security experts. In addition, it's easy to configure and offers cross-platform support.

OpenVPN takes center stage in this article because it can use both the Transmission Control Protocol (TCP) and User Datagram Protocol (UDP). Other VPN protocols either use UDP or TCP but not both communication standards. Usually, if a VPN provider uses the OpenVPN protocol, it lets users choose between TCP and UDP.

UDP and TCP are communication standards used to send bits of data known as data packets over the internet. Both protocols are built on top of the Internet Protocol (IP) protocol.

In layman's terms, when you send a data packet via TCP or UDP, the data packet is sent to an IP address.

Note that the kind of protocol you select between UDP and TCP impacts how your VPN service functions. Each protocol has its own set of advantages and disadvantages. For that reason, you should at least have a basic understanding of the two terms.

Here's what to expect in this article:

  • What are data packets?
  • What is TCP?
  • How TCP works
  • TCP features
  • Advantages of TCP
  • Advantages of using TCP with OpenVPN
  • Disadvantages of TCP
  • Disadvantages of using TCP with OpenVPN
  • How to use OpenVPN over TCP
  • What is UDP?
  • Advantages of UDP
  • Disadvantages of UDP
  • Advantages of using UDP with OpenVPN
  • Disadvantages of using UDP with OpenVPN
  • Why UDP is better for streaming
  • Is there a difference between TCP and UDP?

What Are Data Packets?

Before learning how TCP and UDP work, you need to know how the internet transmits data.

When you send data over the internet or any network, the data is divided into small manageable parts called data packets.

Data packets contain the following:

  • IP address source (the sender of the data packet).
  • Destination IP address (the receiver of the data packet).
  • Flags (Configuration flags indicating a particular connection state).
  • Type of data (Email, audio, video, etc.).
  • Payload (Actual data sent by communicating endpoints).
  • Trailers (Signifies the end of the packet).

Usually, a data packet occupies around 1,000 to 1,500 bytes. TCP and UDP communication standards divide large data into small pieces and send them over the internet. This, in turn, helps with traffic management and avoiding network congestion.

What Is TCP?

TCP is a connection-oriented communication standard used to establish a connection between a sender and receiver of data packets. When a connection is established, it allows the transmission of data in two directions.

TCP has been around since 1983 and is one of the widely used protocols on the internet. It is reliable and has an error-correcting mechanism that differentiates it from UDP.

TCP Error Correction Mechanism Explained

The error correction mechanism guarantees that data is delivered the same way it was sent. Therefore, it is ideal for sending information such as images, data files, and web pages over the internet.

When you send data over the internet using TCP, each data packet is assigned a unique and sequential identifier called a packet number. The receiver has to receive the data in a particular order depending on the packet number. Whenever data is sent and received in the correct order, the receiver sends a message to the sender acknowledging to have received the data.

This feedback mechanism results in a large overhead and may lead to more bandwidth consumption on your network. When the receiver sees a data packet it didn't ask for or doesn't want, it waits for the arrival of the next packet.

The packet number handles the following issues:

Data Duplication

Data duplication is the creation of replica data packets. A receiver can receive replica data packets during the transmission of data. The sequence number handles data duplication by ignoring any data packet it has already processed and ensures data packets are only sent out once.

Data Loss

Data loss occurs when a set of data is compromised, corrupted, deleted, or goes missing. About 1% of data is lost during the transmission of data packets, but this is perfectly reasonable.

When you send data over the UDP protocol, and a receiver doesn't receive a specific data packet, the receiver won't send an acknowledgment message to the sender. For this reason, a sender has to resend the data packet. This way, every data packet is accounted for.

Data Sequencing

As earlier stated, each data packet sent over the TCP protocol has a packet or sequence number. The sequence number ensures that data packets are sent and received in the correct order. If data packets are sent wrongfully or out of order, the receiver will use the sequence number to reassemble the data packets in the correct order.

TCP Checksum

TCP contains a 16-bit checksum field that does error-checking of the TCP header, TCP payload, and IP pseudo-header. The checksum determines the integrity of transmitted data and detects risks in a TCP segment when data packets are sent over a network.

If data was corrupted along the way, the receiver would not send an acknowledgment message to the sender. This prompts the sender to resend the data packets just the same way it sends a missing packet.

How TCP Works

TCP uses the three-way handshake to establish a connection between the sender and receiver of data packets. This is a three-step process requiring both the sender and receiver of information to exchange synchronization and acknowledgment packets before communication is established.

It is designed in such a way that both endpoints initiate, negotiate and separate TCP socket connections simultaneously. The three-way handshake process also allows the transfer of multiple TCP socket connections in two directions simultaneously.

Common TCP Three-Way Handshake Terminologies

SYN (Synchronization flag): Initiates and establishes a TCP connection.

ACK (Acknowledgement flag): Confirms to the sender that it has received the SYN.

SYN-ACK: The SYN message of the sender and ACK of the sent packet.

FIN (Finished flag): Terminate the connection.

TCP Three-Way Handshake Process

There are three steps involved in the three-way handshake process, as discussed below:

Step 1

The client first initiates the conversation by requesting to communicate with the server. After that, the server may accept or reject the connection.

After the server accepts the request, communication is established between the two. The client then sends a data packet segment with SYN and informs the server of its sequence number.

Step 2

The server then sends an SYN-ACK signal set to the client. SYN signifies the sequence number of the segments, while ACK signifies the response of the received segment.

Step 3

The client acknowledges the server's response, and a connection is established between the two before actual data transfer begins.

TCP Features

Delivery acknowledgments: The receiver sends delivery acknowledgments to the sender when information is received in the correct order, and there are no missing data packets.

Retransmission: When the sender does not receive delivery acknowledgments from the receiver, it retransmits the information.

Easy error detection: A TCP checksum determines data integrity and detects errors in data transmission.

Transmission delay: This delays data transmission because of network congestion.

Advantages of TCP

  • Can set up a connection between different types of devices.
  • Operates outside the operating system.
  • Supports multiple routing protocols.
  • Supports internetworking between organizations.
  • Supports multiple routing protocols.
  • Allows users to operate it independently.

Advantages of Using TCP With OpenVPN

Below are the benefits of selecting the TCP protocol in OpenVPN:

High Reliability

TCP is highly reliable because it guarantees that data packets are delivered the same way they were sent and conducts error detection during data transmission. In addition, it works well with OpenVPN encryption because it handles missing packets that can lead to slow connections.

High Compatibility

Because it is one of the most popular communication standards on the internet, most networks and firewalls do not block TCP traffic. Therefore, TCP requests are allowed for normal internet traffic in the Domain Name Server (DNS) port 53, Hypertext Transfer Protocol (HTTP) port 80, and Hypertext Transfer Protocol Secure (HTTPS) port 443.

Disadvantages of TCP

  1. Does not support broadcast or multicast transmission.
  2. Users need to create their own block boundaries.
  3. May waste bandwidth because of its error-detection mechanisms.
  4. No guarantee of data packets delivery in the transport layer.
  5. Hard to replace the TCP/IP protocol.
  6. No clear separation of services, interfaces, and protocols.
  7. No way to conclude a transmission without asking all data packets in motion.

Disadvantages of Using TCP With OpenVPN

Below are the drawbacks of selecting the TCP protocol in OpenVPN:

High Overhead

TCP has error detection and delivery mechanisms that create significant overhead and delay VPN connections. For instance, for every data packet sent, the receiver needs to send an acknowledgment message to the sender; otherwise, the sender will need to retransmit the data, and this delays the forwarding of other data packets.


TCP will keep retransmitting missing or dropped data packets if you're using an unstable network and create a connection delay or lag. That's why TCP is only ideal for sending static data, such as web pages, but is not so great when used in time-sensitive applications, such as Voice over Internet Protocol (VoIP), video, or gaming.

How To Use OpenVPN Over TCP To Fight Censorship?

Some governments have employed stringent measures to censor internet access for their citizens. For example, they block access to websites they deem "anti-government" and limit their citizen's access to the internet.

Using a VPN is one of the best ways to circumvent internet censorship.

For this reason, some governments have blocked VPN usage in their countries. However, you can bypass such restrictions by using OpenVPN with TCP to access Secure Sockets Layer (SSL) websites.

SSL is a protocol used to establish authenticated and encrypted links between networked devices. It encrypts web traffic and verifies the server identity or the website owner. When you connect to a secure website (websites with URLs starting with https://), the browser sends a TCP request via port 443.

Port 443 is a communication endpoint used to direct traffic to the right destination and is the primary port for HTTPS traffic. You can configure OpenVPN to run TCP on port 443 because it is built on OpenSSL libraries.

When you use a VPN service employing the OpenVPN protocol configured to run TCP on port 443, the internet traffic sent will look like regular website SSL traffic.

For this reason, even if the government has blocked VPN usage, you can bypass the restrictions because your traffic will seem to be from a regular browser. Also, the traffic sent will be encrypted, meaning there's no way your ISP or the government will know the websites you visit. Therefore, using OpenVPN with TCP is an effective way of hiding VPN use and circumventing internet censorship.

What Is UDP?

UDP is a connectionless internet transmission protocol used in special circumstances, such as broadcast and multicast transmission. It is connectionless because there's no overhead for establishing, maintaining, or terminating a connection over a network.

UDP breaks down data the same way as TCP but does not assign a sequence number for data packets transmitted. As a result, it lacks a built-in error detection mechanism but has a checksum that ensures data packets arrive at their destination uncorrupted.

The lack of error correction makes UDP more prone to errors but also makes it much faster than TCP. This is the primary reason why fast VPN providers opt for UDP as the default OpenVPN protocol. UDP should be your ideal communication standard if you want to transmit a high volume of data with minimal delay.

It also lacks a message delivery confirmation mechanism to maintain message forwarding from the sender to receiver continuously whether they receive it or not. Consequently, even if some data packets go missing, this won't prevent UDP from forwarding the remaining data packets.

There's also no mechanism for resending missing data packets on UDP.

For this reason, UDP is not ideal for sending emails, webpages or downloading a file from the internet. It is a communication standard preferred for real-time communications and VoIP.

Advantages of UDP

  • Supports broadcast and multicast transmission.
  • Bandwidth-intensive.
  • Not restricted to a connection-based communication model.

Disadvantages of TCP

  • Has no deliverability guarantee.
  • Lacks congestion and flow control.
  • Compared to TCP, it is prone to packet loss.

Advantages of Using UDP With OpenVPN

Using UDP with OpenVPN has its advantages, as discussed below:

Ideal for Slow Connections

It is recommended to configure OpenVPN to use UDP if you have a slow internet connection. This is because TCP mechanisms of error detection and deliverability guarantees often create encryption overheads that require extra processing. UDP has no overheads; therefore, it can transmit data packets even in a slow network connection.

Works Great With Time-Sensitive Data

In a TCP connection, dropped data packets are resent to the receiver before normal data transmission resumes. This creates latency and is the primary reason time-sensitive data cannot be sent over TCP.

Examples of time-sensitive data include:

  • Live video streaming.
  • Sending or receiving VoIP traffic.
  • Audio streaming and online gaming.

When transmitting this kind of data, dropped data packets are not prioritized, and data transmission stays continuous. UDP transmits data continuously and doesn't check if any data packets are missing. That's the reason why UDP is ideal when it comes to transmitting time-sensitive data.

Disadvantages of Using UDP With OpenVPN

Even though UDP offers better speed than TCP, there are some drawbacks of selecting the UDP protocol in OpenVPN, as discussed below:

Less Reliability

UDP is less reliable when it comes to data transmission because it is prone to missing or corrupted data, especially when there are network issues. This may lead to failed downloads or dropped connections. That's the reason TCP is preferred for downloads and sending of files over the internet.

Compatibility Issues

Some network environments limit inbound and outbound traffic to maintain network security. For instance, UDP has more restrictions than TCP and is often blocked by firewalls. For this reason, if you use UDP with OpenVPN, it may lead to failed connections.

Why UDP Is Better for Streaming

UDP Is Much Faster

UDP lacks TCP's error detection mechanism, and the sender doesn't need any acknowledgment from the receiver to forward data packets. As a result, it has no overheads, transmitting data faster than TCP.

UDP Has Lower Latency

UDP sends data continuously whether the receiver receives the data packets or not. As a result, there's no latency in between data transmission even if data packets are dropped along the way.

UDP Is More Responsive

TCP provides communication between two endpoints. However, given that broadcast and multicast only send data, they don't work with TCP.

But this is not the case if you use UDP; it supports many paradigms, such as multicast and broadcast. Besides, live streams play much faster in UDP.


Is There a Difference Between TCP and UDP?

There are major differences between TCP and UDP, based on the following factors:


TCP is slower than UDP because of its properties, such as error detection mechanism and retransmission of lost data packets requiring extra processing and time. On the other hand, UDP is faster, simpler, and efficient because it ignores dropped data packets and keeps forwarding data packets even if deliverability is not guaranteed.

Connection Status

TCP requires the sender to establish a connection with the receiver first, then uses the three-way handshake process to maintain a connection. After data transmission is complete, the connection is closed. On the other hand, UDP is a connectionless protocol meaning it doesn't require an established connection to transmit data and has no requirements of terminating a connection either.


TCP is more reliable than UDP because it guarantees the delivery of data packets to the destination. On the contrary, UDP is unreliable because it does not guarantee the delivery of data packets to the destination.

Data Sequencing

TCP assigns a sequence number to all data packets, ensuring orderly delivery of data from the sender to receiver and vice versa. UDP does not assign sequence numbers to its data packets and lacks data sequencing of any sort. If data packets need to arrive in order, this has to be managed at the application layer.

Guaranteed Delivery

When you send data over a TCP connection, the delivery of data packets to the receiver is guaranteed because the receiver will send an acknowledgment message after receiving the data. However, there's no acknowledgment message sent from the receiver to the sender after data packets are delivered in a UDP connection, meaning there's no guarantee of data delivery.

Error Detection and Correction

TCP has a 16-bit checksum that does error checking and determines the integrity of data sent. It also has flow control and data acknowledgment. UDP has no error detection mechanism but has a checksum that ensures data packets are delivered uncorrupted to the receiver.

Transfer Method

TCP reads data as a byte stream and transmits messages to segment boundaries. UDP data packets are sent individually with defined boundaries, and their integrity checked on arrival.

Broadcasting and Multicasting

TCP does not support broadcasting and multicasting, while UDP supports both. 

Retransmission of Data

Lost or corrupted data packets can be retransmitted in TCP, but UDP lacks such features.

Length Header

The length header of TCP occupies about 20 to 60 bytes, making TCP heavy-weight. On the other hand, UDP has a fixed-length header of 8 bytes which makes it lightweight.


TCP is used by HTTP, HTTPS, SMTP, FTP, Telnet, SHTTP, NBNS, POP, etc. UDP's common applications include video conferencing, streaming, SNMP, DNS, DHCP, TFTP, VoIP, etc.


TCP and UDP differ in the way they transmit data over the internet. TCP is more reliable and works well with static data but has encryption overheads that lag in speed. On the other hand, UDP is fast and ideal for sending time-sensitive data, e.g., video streaming, gaming, and VoIP.

Leave a Reply

Your email address will not be published. Required fields are marked *

One comment on “What Is The Difference Between TCP And UDP?”

  1. I am an investor of gate io, I have consulted a lot of information, I hope to upgrade my investment strategy with a new model. Your article creation ideas have given me a lot of inspiration, but I still have some doubts. I wonder if you can help me? Thanks.