User Datagram Protocol (UDP)

In VoIP technology SIP often uses UDP for packet transferring. UDP (User Datagram Protocol) is a part of the IP suite of protocols and it is used for data transferring. Details can be found on this page.

The User Datagram Protocol (UDP) belongs to the Internet Protocol Suite that is a set of network protocols for the Internet. UDP makes computers possible to send messages (referred to as datagram in the case of UDP) to other hosts on an IP (Internet Protocol) network. The great advantage of this protocol is that special transmission channels or data paths are not required.

To avoid overheads at the network, UDP supposes that error checking and correction is not necessary. That is why time-sensitive applications often employs UDP as real-time systems may prefer dropping packets instead of waiting for delayed ones. Furthermore, UDP is compatible with packet broadcast (refers to sending to all on local network) and multicasting (means sending to all subscribers).

However, unlike TCP (Transmission Control Protocol), UDP does not guarantee transferred data integrity, reliability or ordering. In practice it means that datagrams may arrive out of order, appear duplicated, or lost without notice. Since UDP does not check the integrity of data transfer, it cannot recover lost or damaged packets or even it doesn't acknowledge that the packets being sent have been received or not.

For these reasons, UDP is typically applied in cases in which the loss of smaller part of the sent data does not cause any problem or even it is desired (for example in case of overheads); or if there is an upper layer protocol that corrects these errors. Streaming media, real-time multiplayer games and voice over IP (VoIP) are examples of applications that often use UDP.

UDP vs TCP

TCP allows to acknowledge received packets toward the sender and several error-checking functions are also included ensuring that packets are received by the recipient. Figure 1 demonstrates a TCP packet.

tcp packet
Figure 1 - TCP packet

As opposed to TCP, UDP includes the Source, the Destination, the Length, a Checksum and a Data field that can be larger in size than in case of TCP. There is no error-checking function in UDP that is why this protocol is faster. Due to these facts, VoIP employs UDP since it is faster and can include larger data in the packet. However, packet loss can occur with this protocol, VoIP calls can tolerate these failures and good quality calls can be produced.

udp packet
Figure 2 - UDP packet

UDP Datagrams

As it comes from its name UDP ensures network traffic in the form of datagrams. A datagram includes one message unit. The header information is included in the first eight bytes of the datagram while the message data is comprised in the remaining bytes. A UDP datagram header builds-up four fields and each of them is two bytes:

  • Source port number
    This field identifies the port of the sender and it is considered to be the port to which replies can be sent if it is necessary. If it is not used, it is zero.

  • Destination port number
    This field identifies the port of the receiver.

  • Datagram size/Length
    This field defines the whole datagram's length including the header and data. The minimum length is 8 bytes as it is the length of the header.

  • Checksum
    Checksum field checks the header and data for errors.

UDP Ports

Datagram sockets are employed by UDP applications to generate host-to-host communications. These sockets are responsible for connecting UDP application to service ports that are the endpoints of data transmission. Ports are identified by port numbers. Valid UDP port numbers range from 0 to 65,535.

Related Pages

More information