TCP vs UDP for VoIP
11 January 2022UDP? TCP? A walk-through transport communication protocol.
If you have configured an IP Phone or softphone before, you may be familiar with the term “transport”. Are you familiar with it and do you know how does it work?
To understand what a “transport” is, we first need to understand how IPs work. An Internet Protocol (IP) sets the rules that govern the format in which data is exchanged by all systems connected to public or private networks. All devices that connect to a network are assigned an IP Address, with the goal of identifying devices from all over the internet. Each IP address contains location information that makes each device reachable for communication. IP addresses are a string of numeric digits separated by periods and usually expressed in groups of four numbers called octets. But how do IP addresses work and communicate with each other? As with any other coding language, IP works by using well-established guidelines and properly defined rules. If two devices in a network can understand and communicate in the same language, then they are able to establish a successful connection and exchange information with each other. The process, although invisible to the human eye, can be quite complex. First, your device will connect to a network with internet access via an Internet Service Provider, who will assign an IP to your device and handle your devices’ requests, either sending them to the proper destination or routing inbound traffic towards your device. These IP addresses assigned to your devices may change at a certain point, and those are called “Dynamic IPs”, while the ones that do not change are called “Static IPs”.

Now that we have a better understanding of the basics, we can move to our next topic ‘transport’. We now know that information is exchanged between your device and other devices in a network using the Internet Protocol from one IP address to another (and vice versa), but how exactly this information is shared we’ll discover next: information from one peer is sent in what’s called a packet, and packets can be sent in distinct forms, either by using a UDP or TCP protocols. therefore, it is known as transport the protocol devices can use to communicate to other peers in a network to interchange packets to each other.
UDP, also known as User Datagram Protocol, is a communication protocol widely employed for multiple purposes, among these we could highlight time-sensitive transmission (video playback) or DNS lookups (DNS stands for Domain Name System, it is basically a directory for the internet, where you could enter https://www.voip.ms in your browser, DNS will translate such name to an IP address and locate the required website information on the proper destination in order to show it to you). The peculiarity of this protocol is that it does not require establishing a connection before data is sent or received, speeding up the process, with the downside of possible packet loss in the process (which could eventually cause vulnerabilities in a specific setup).
The TCP protocol, also known as Transmission Control Protocol, while offering the advantage of being a more secure protocol, has the disadvantage of requiring more bandwidth than a UDP. TCP allows devices using Internet Protocol to remain connected with the purpose of ensuring packet order, therefore guaranteeing the exchange of these packets. Unlike the UDP protocol, TCP requires establishing a handshake with the receiving party for the process to be able to complete successfully. Taking a closer look at the process, basically, the device that initiates the connection asks firsts for the destination device’s availability, then, the receiver returns a response and then the sender acknowledges the response sent by the receiving destination and initiates communication if the receiver is available. This process is known as the “3-way handshake”, it takes place right before any data interchange takes place and it’s in this stage where ports used in the connection are reserved aiming to have a reliable connection between the devices involved. The TCP protocol also has capabilities to identify lost data packets in the exchange process, the idea is to guarantee no data packets will be lost at any given moment. The downside of this whole path TCP protocol takes to send and receive information is that this process takes more time and resources to function.

While it is well-known that a TCP protocol is considerably more secure than a UDP protocol, connections can still be at risk while using TCP, there have been registers of more elaborate, complex attacks on TCP connections that require high-end solutions to ensure the protection of such connections. In summary, let’s go through the advantages of both UDP and TCP protocols:
- TCP is a connection-oriented protocol, devices attempting to share information must first establish a connection before being able of transmitting any data, this connection should be closed as soon as data is sent/received, and UDP leaves the connection open due to the lack of an overhead that opens it, maintains it, and then terminates, which would be recommended for multicasting as well as for broadcasting transmissions.
- UDP can’t guarantee data reaches the intended destination, while TCP does guarantee this.
- TCP provides further error checking methods, which are lacking on UDP, UDP offers basic error checking by using checksums.
- There’s no acknowledgment segment on UDP, while you do find these on TCP.
- TCP is a tad bit slower due to being a bit more “heavy-weight”, while UDP is because it is lighter.
- UDP has no data sequencing, if required, this will need to be done in the application layer, while TCP ensures the arrival of the packet in the order these need to be sent/received.
Conclusion: While both protocols will have you properly connected, UDP should be employed when speed is the priority, considering any possible security issue this protocol may imply, while TCP is the option to give priority to accuracy, due to the fact TCP ensures no packet loss in the process.
Share:
Back to Blog