menu

TCP versus UDP for IP Phones: How do you choose?

UDP for IP Phones

The internet is like a very crowded Los Angeles highway, but instead of being full of cars, it’s full of information. Due to crowding, this information needs guidance to ensure that it gets where it’s going.  This is why transmission protocols exist to make sure the information gets transported as intended.

For example, public transportation in cities have multiple bus routes, and buses. Communication is like a bus passenger, it’s moving on the bus but needs to take the right route to arrive at its destination. If the passenger chooses the wrong route he or she may not make it to their intended destination.  The transmission protocol keeps the VoIP call, email, or text message on the proper route.

What is a transport protocol?

When communication is sent through the internet, it is a layered process comprised of five separate layers. The main two layers we will discuss today are the Application Layer and the Transport Protocol layer. For our purposes, the application is SIP and the major transport protocols typically used for SIP are Transmission Control Protocol (TCP) and User Datagram Protocol (UDP). Below is a diagram to show the various layers involved.

What is a transport protocol?

Information sent over the internet is sent in tiny packets from point A to point B. The transport protocol chosen determines how fast they get there, if they are in the right order, and if the sender gets verification that these packets arrived.

TCP Explained

TCP is commonly used for email, file downloading etc. It is considered a connection-oriented protocol because before the packet is transmitted, one side reaches out to the other side for a confirmation before sending the actual information.  If TCP were a conversation, it would look like this:

Person 1: Hi, are you there?

Person 2: Yes, I’m here!

Person 1: Great, I’m sending information to you.

Person 2: Information received!

This is called a “handshake” TCP ensures that the destination is open to communicate, and then acknowledges that the information was sent. TCP is very reliable as all packets are confirmed once they are sent. TCP also makes sure that all the packets arrive in the correct order, ensuring proper communication. It helps to think about TCP in terms of sending a package across the country and paying extra for tracking and insurance.

Ok, so why don’t we use TCP for everything? Because it is sllooww. It also requires a lot of bandwidth (referred to in the industry as overhead). It is not suited to real-time communications. For example, if you send an email and it gets stuck, it will try to resend until it arrives. Can you imagine a phone conversation where this is the case?  If someone called you and said, how are you? But the word “are” skipped out because the packet got dropped. Imagine the delay if the “are” kept getting sent back over and over again. The conversation would no longer make sense and would be largely delayed.

UDP is the Best choice for voice

Grandstream IP Phones can use either TCP or UDP, but by default are set to UDP. UDP is more suited to fast communications such as voice and video streaming. There is no acknowledgement, there is no handshake, and UDP does not deliver the packets in order. But in a real-time phone conversation, the importance is the speed of delivery, not necessarily the accuracy. During a conversation, if a small portion of word skips out, it’s still clear what the other person is saying. If the packet kept trying to resend, it would sound like a skipping CD and would not be clear. So while to those not familiar with TCP, the accuracy and guarantee of it may seem alluring, in reality it just isn’t practical for voice communications.

Topics: VoIP, Grandstream Solution