Does VoIP Use TCP or UDP?

TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) are the two most widely used communication protocols for transmitting data over the internet. So which of the two is used with VoIP?

Does VoIP use TCP or UDP? VoIP uses UDP in most cases. However, voice over IP communication can use either where needed.

To fully explain why VoIP uses UDP rather than TCP, it’s important to understand each protocol and how they differ. Starting with TCP, I’m going to explain what each protocol is and how it works. After, I’ll explain why VoIP normally uses UDP.

What Is TCP?

TCP is one of the major protocols of the Internet protocol suite. TCP is a connection-oriented protocol, which means a connection between the client and the server needs to be established before any data can be exchanged.

Many major internet applications are reliant upon TCP. For example:

  • World Wide Web
  • Email
  • File Transfer

TCP is a very reliable protocol, with multiple protections in place to prevent packets getting lost during transmission. TCP is a protocol that guarantees reliable delivery and error-free data transfer.

Reliable transmission is possible because of the way that TCP handles each piece of data. Here’s a quick explanation of how it works:

TCP uses a unique number to identify each piece of data. This means that the data can be reconstructed in order when it reaches its destination. Furthermore, if any byte is missing in the sequence, it will be detected and retransmitted.

Sequence numbers enable the receiving server to restructure data in the correct order and also discard packets that have been duplicated. Additionally, the receiver sends ACKs (Acknowledgements) for each byte. Therefore, if a packet is missing, the sender can retransmit the missing packet to ensure no data is lost.

That’s a brief look at what TCP is and how it works. Based on what you’ve read here – about how reliable TCP is – you’re probably wondering why it isn’t really used for VoIP. I’ll first explain a bit more about UDP, and then I’ll tell you why VoIP usually uses UDP rather than TCP.

What Is UDP?

UDP is another very popular protocol; one of the core members of the Internet protocol suite. With UDP, client devices can send data to other IP networks. UDP differs from TCP is numerous ways, but the biggest difference is that prior communications are not needed to send data.

UDP is often described as more basic than TCP, because it uses a connectionless communication model. For example, it has no handshaking dialogues, whereas TCP does.

Unlike with TCP, there is no guarantee of packet delivery or ordering. In fact, there are no error-correction facilities at all. Consequently, UDP certainly isn’t an ideal protocol for some types of service. However, it is ideal for VoIP.

VoIP’s a time-sensitive application. Real-time communication is needed, so the latency of TCP would seriously affect the quality of calls over an IP network. Dropping packets in time-sensitive applications is generally preferable to waiting for delayed packets to come through. That’s why UDP is used for VoIP more often than TCP is. It is possible to use either, but it’s illogical to use TCP and cause major delays to what needs to be real-time conversations.

TCP Vs UDP: A Comparison

Although I’ve already stated that UDP is used for VoIP more regularly than TCP is, I thought it would be a good idea to compare the two protocols in more detail and really explain why that is.

Connection-Oriented Vs Connectionless

I briefly mentioned earlier in this blog post that TCP is connection-oriented, whereas UDP is a connectionless protocol. But what does this mean for VoIP performance?

A connection-oriented protocol such as TCP uses a three-way handshake to establish a connection. This is an automated process between the client and the server that takes place before the communication begins. The process consists of the client contacting the server and the server acknowledging the connection. The ‘handshaking’ dialogues cover ordering, reliability, and data integrity. Then the connection is established.

With a connectionless protocol such as UDP, there is none of this virtual handshaking. With UDP, there’s no error-checking or error-correction, so dropped packets will go unnoticed and won’t be retransmitted.

So how does this affect the suitability for VoIP? Well, transmission speed with UDP is faster because there’s no handshaking, error-checking, or error-correction. While the delivery of data isn’t guaranteed with UDP, voice communication is smoother and more natural because there aren’t any error protocols causing latency.

Speed And Latency

Speed and latency are particularly important considerations when thinking about the ideal VoIP setup. You want to make sure packets are transmitted as quickly as possible with little latency for high-quality conversations. So which of the two protocols are best for this?

UDP is by far the best protocol to use for Voice over Internet Protocol communications. UDP is much faster, because there aren’t the guarantees that you get with TCP. All the ACKs, error-monitoring, and error-correction require more resources and takes up time. This can cause latency when you’re on the phone, meaning the receiver might not hear what you’re saying for a few seconds after you’ve said it. That’s really not ideal for VoIP communications; you want quick, lag-free communication, not latency-ridden calls.

UDP doesn’t guarantee that packets will arrive in order, or all the packets will arrive. But this doesn’t really cause a problem for Voice over IP communications. A few packets missing will simply cause a few seconds of silence, or something along those lines. That’s better than the latency that you’d have when using TCP.

I will note here, however, that TCP’s guarantees that no packets are missing are beneficial in some scenarios. For example, when you’re sending important files to another device. However, it really doesn’t matter with VoIP if some packets go missing.

Error Checking Mechanisms

Let’s also consider the error-checking mechanisms that these two protocols have. TCP has a wide range of error-checking mechanisms, such as:

  • Checksum: TCP uses checksums to check data for errors. A checksum is a sequence of numbers and letters used solely to detect data for errors. Checksums are used to detect errors that have been caused while the data is in transmission or while the data was stored. Each segment of a data transfer using TCP contains a checksum that checks for data corruption. If the packet is corrupted, it will be discarded and resent by you (the client).
  • Acknowledgements (ACKs): TCP uses Acknowledgements, or ACKs, that are used to verify each segment of data reaches the target server. Here’s how an ACK works: The client (you) sends an ACK for each segment of data. The server you’re sending data to receives that ACK and sends back an acknowledgement that the data segment has been received. If the server receives an ACK but not the data, it ‘replies’ to the client that the data wasn’t received, after which the data segment will be retransmitted by the source/client.

The TCP protocol is used where error-free data transfer is absolutely essential. For instance, when you’re transferring large files onto a website. Obviously, the error-detection and error-correction mechanisms of TCP increase latency. If you need packets to be retransmitted, such as when you’re transferring a file of important data, having these mechanisms is advantageous. However, it just causes problems for VoIP when the odd packet or two going missing isn’t such a big deal.

So what error-checking and error-correction mechanisms does UDP have? UDP does use checksum in the same way I detailed above, with one key difference. When you’re using UDP, the receiving server will not request the corrupted packet to be retransmitted. So the receiving server ‘sees’ that the packet is lost and does nothing about it. That wouldn’t be much good if you were transferring important data that became corrupted! However, it really doesn’t matter that much for VoIP. You might notice that the audio cuts out slightly, for example, but there would be no persistent or long-term effect on the communication.

So that’s how TCP and UDP works, and why UDP is the best for VoIP. I hope this blog post has helped you to learn more about the two widely-used protocols!

Jack Mitchell

Jack Mitchell has been the Operations manager at telecoms and MSP Optionbox for more than 4 years. He has played a crucial role in the company, from marketing to helpdesk, and ensures that the IT requirements of over 300 clients are continuously met. With his innate passion for technology and troubleshooting and a particular interest in Apple products, Jack now delivers the most comprehensive tech guides to make your life easier. You can connect with Jack on LinkedIn.

Recent Posts