Definition

UDP (User Datagram Protocol)

UDP (User Datagram Protocol) is a communications protocol that is primarily used for establishing low-latency and loss-tolerating connections between applications on the internet. It speeds up transmissions by enabling the transfer of data before an agreement is provided by the receiving party. As a result, UDP is beneficial in time-sensitive communications, including voice over Internet Protocol (VoIP), domain name system (DNS) lookup, and video or audio playback. UDP is an alternative to Transmission Control Protocol (TCP).

Both UDP and TCP run on top of IP and are sometimes referred to as UDP/IP or TCP/IP; however, there are important differences between the two. For example, UDP enables process-to-process communication, while TCP supports host-to-host communication. Furthermore, TCP sends individual packets and is considered a reliable transport medium. On the other hand, UDP sends messages, called datagrams, and is considered a best-effort mode of communications -- meaning the service does not provide any guarantees that the data will be delivered or offer special features to retransmit lost or corrupted messages.

Content Continues Below

UDP provides two services not provided by the IP layer. It provides port numbers to help distinguish different user requests and, optionally, a checksum capability to verify that the data arrived intact.

TCP has emerged as the dominant protocol used for the bulk of internet connectivity due to its ability to break large data sets into individual packets, check for and resend lost packets, and reassemble packets in the correct sequence. But these additional services come at a cost in terms of additional data overhead and latency.

In contrast, UDP is considered a connectionless protocol because it doesn't require a virtual circuit to be established before any data transfer occurs. The communication protocol just sends the packets, which means that it has much lower bandwidth overhead and latency. With UDP, packets may take different paths between sender and receiver, and as a result, some packets may be lost or received out of order.

User Datagram Protocol features

User Datagram Protocol has attributes that make it beneficial for use with applications that can tolerate lost data. For example:

  • It allows packets to be dropped and received in a different order than they were transmitted, making it suitable for real-time applications where latency might be a concern.
  • It can be used for transaction-based protocols, such as DNS or Network Time Protocol (NTP).
  • It can be used where a large number of clients are connected and where real-time error correction isn't necessary, such as gaming, voice or video conferencing, and streaming media.

UDP header composition

UDP uses headers when packaging message data to transfer over network connections. UDP headers contain a set of parameters -- called fields -- defined by the technical specifications of the protocol.

The User Datagram Protocol header has four fields, each of which is 2 bytes. They are the following:

  • source port number, which is the number of the sender;
  • destination port number, the port the datagram is addressed to;
  • length, the length in bytes of the UDP header and any encapsulated data; and
  • checksum, which is used in error checking -- its use is required in IPv6 and optional in IPv4.

UDP header format
The composition of the four UDP header fields: source port, destination port, UDP length and checksum

How UDP works

UDP uses IP to get a datagram from one computer to another. UDP works by gathering data in a UDP packet and adding its own header information to the packet. This data consists of the source and destination ports to communicate on, the packet length and a checksum. After UDP packets are encapsulated in an IP packet, they're sent off to their destinations.

Unlike TCP, UDP doesn't guarantee that the packets will get to the right destinations. That means that UDP doesn't connect to the receiving computer directly -- which TCP does. Rather, it sends the data out and relies on the devices in between the sending and receiving computers to correctly get the data where it's supposed to go.

Most applications that use UDP wait for any replies that are expected as a result of packets sent using the communication protocol. If an application doesn't receive a reply within a certain time frame, the application sends the packet again, or it stops trying.

UDP uses a simple transmission model that doesn't include handshaking dialogues to provide reliability, ordering or data integrity. Consequently, UDP's service is unreliable, and packets may arrive out of order, appear to have duplicates or disappear without warning.

Although this transmission method doesn't guarantee that the data being sent will reach its destination, it does have low overhead, and it's popular for services that don't absolutely have to work the first time.

Applications of UDP

UDP can be used in applications that require lossless data transmission when the application is configured to manage the process of retransmitting lost packets and correctly arranging received packets. This approach can help to improve the data transfer rate of large files compared to TCP.

In the Open Systems Interconnection (OSI) communication model, UDP, like TCP, is in Layer 4, the transport layer. UDP works in conjunction with higher-level protocols to help manage data transmission services, including Trivial File Transfer Protocol (TFTP), Real Time Streaming Protocol (RTSP) and Simple Network Management Protocol (SNMP).

UDP is an ideal protocol for network applications in which perceived latency is critical, such as in gaming and voice and video communications, which can suffer some data loss without adversely affecting perceived quality. In some cases, forward error correction techniques are used to improve audio and video quality, despite some loss.

UDP can also be used for applications that depend on the reliable exchange of information but should have their own methods to answer packets. These services are advantageous because they're not bound to fixed patterns to guarantee the completeness and correctness of the data packets sent. Users can decide how and when to respond to information that's not correct or sorted.

UDP can also be used for multicasting because it supports packet switching. In addition, UDP is used for some routing update protocols, such as Routing Information Protocol (RIP).

UDP can be used in applications where speed rather than reliability is critical. For instance, it might be prudent to use UDP in an application sending data from a fast acquisition where it's OK to lose some data points.

TCP vs. UDP

TCP and UDP are part of the TCP/IP protocol suite, which includes a number of protocols for carrying out network communications.

A chart displaying the differences between UDP and TCP

UDP characteristics include the following:

  • It is a connectionless protocol.
  • It is used for VoIP, video streaming, gaming and live broadcasts.
  • It is faster and needs fewer resources.
  • The packets don't necessarily arrive in order.
  • It allows missing packets -- the sender is unable to know whether a packet has been received.
  • It is better suited for applications that need fast, efficient transmission, such as games.

TCP characteristics include the following:

  • It is a connection-oriented protocol.
  • It's the most widely used protocol on the internet.
  • It guarantees that no packets are missing and all the data that's sent makes it to the intended recipient.
  • It sends packets in order so they can be stitched back together easily.
  • It's slower and requires more resources.
  • It has a bigger header than UDP.
  • It is best suited for apps that need high reliability, and transmission time is relatively less critical.
This was last updated in April 2020

Continue Reading About UDP (User Datagram Protocol)

Dig Deeper on Network protocols and standards

Join the conversation

15 comments

Send me notifications when other members comment.

Please create a username to comment.

Cleancut explanation. Fantastic and Thanks
Cancel
Glad you found our definition helpful, bobasdfsdf!
Cancel
Humor me for on this, why would anyone use UDP over TCP? It seems to have many disadvantages, what am I missing?
Cancel
John Garret, I believe what you mean is "Why would anyone use TCP???" Okay, just joking there, but there is actually a big drive on to just remove TCP from the world of networking. Why? Well, the network is much more reliable than in the past. TCP breaks packets up on the one side, then reassembles them on the other side of the connection, and then does a bunch of calculations to make sure each packet has come in. It's a lot of work! Plus, sometimes a lost packet doesn't matter. Imagine you are watching a video and the packets for one frame are lost. Should the video freeze until all the packets are found, or should the video just keep playing, using all the new packets that have come in? Sometimes a lost packet or two doesn't matter. They say Netflix accounts for half of all Intenet usage in the US. That's a lot of packets to keep track off, especially if a lost packet or two really doesn't matter. Speed. Efficiency. Practicality. Those are all reasons that people are moving towards UDP and away from TCP.
Cancel
Which applications have you found user datagram protocol to be most beneficial?
Cancel
1. Big file (more than 100 GB) transfer where sender application on one side splits files in PDUs and receiver application rebuilds PDUs in order to recreate the original file. Project STATEL for the European Commission.
2. HDTV
Cancel
In which applications would you consider not using the User Datagram Protocol?
Cancel
Thats a nice explanation. And thank you.
Cancel
My antivirus software shows UDP4 files that have been open for 14 days. And I just got notice that my email password had changed - it had not. Could this be a hacker tool?
Cancel
Hello, FatRoger431! I suggest you ask your questions on our Questions & Answers forum. Our experts should be able to help you out!
Cancel
Video Games and other state driven software ..like ATM(Automated Teller machines) where once a transaction is done it is done with..if the UDP/IP packet informing the  change in state it lost or not reached to intended client. it is not transmitted again ..Because if the packet were to be transmitted by that time another state change would have  happened in real time and the user will be one state behind due to re transmission....
Cancel
Very helpful content it is.
Cancel
I'm into Home-Automation segment, we find UDP suitable in most of the devices as it becomes difficult to maintain TCP connection between Control Processor & end device. With UDP as-and-when there is a change in device parameter or state, it is immediately communicated to Processor (Feed-Back).
Cancel
can UDP data send to PLC?
Cancel
can anyone tell me Why UDP is not a suitable option for Email application? 
Cancel

SearchUnifiedCommunications

SearchMobileComputing

SearchDataCenter

SearchITChannel

Close