Top: "IP TUTORIAL: USER DATAGRAM PROTOCOL" > Page 1, 2
UDP vs. TCP: Speed vs. Reliability
The primary difference between UDP and TCP lies in their respective implementations of reliable messaging. TCP includes support for guaranteed delivery, meaning that the recipient automatically acknowledges the sender when a message is received, and the sender waits and retries in cases where the receiver does not respond in a timely way.
UDP, on the other hand, does not implement guaranteed message delivery. A UDP datagram can get "lost" on the way from sender to receiver, and the protocol itself does nothing to detect or report this condition. UDP is sometimes called an unreliable transport for this reason.
Another way in which UDP works unreliably is in the receipt of a burst of multiple datagrams. Unlike TCP, UDP provides no guarantees that the order of delivery is preserved. For example, a client application might send the following four datagrams to a server
D1 D22 D333 D4444but UDP may present the datagrams to the server-side application in this order instead:
D333 D1 D4444 D22
In practice, UDP datagrams arrive out-of-order relatively infrequently -- generally only under heavy traffic conditions.
The Case For UDP
On the surface, an "unreliable" network protocol may not seem very worthwhile or desirable. But in fact, UDP can be very useful in certain situations, and it enjoys one key advantage over TCP -- speed. The reliability features built into TCP can be expensive in terms of overhead at execution time. Also note that UDP does not preclude reliable message delivery, it merely defers those details to a higher level of the network stack.
The original specification for UDP is RFC 768, published in 1980. Despite its age, UDP continues to be used in mainstream applications. Video conferencing systems in particular have proven a good fit for UDP because they have been willing to sacrifice some reliability (i.e., picture quality) in return for performance (i.e., higher frame rates). This is the classic tradeoff between UDP and TCP, and it appears both transports still have their place in today's networking world.
| Learn More About It |
Our
Protocols subject area contains many more links to network protocols like UDP.
|

