Networking fundamentals – a dive into the UDP protocol

Web DevelopmentThe previous post in this three-part “Networking Fundamentals” series reviewed the IP protocol – the backbone of the Internet. Next is the UDP protocol, which rides on top of the IP protocol to provide the delivery of actual data between computers.

Before we dive into the UDP protocol itself, it will be helpful to review the full networking stack. Modeled after a seven layer salad dip, the engineers at the International Organization for Standardization (ISO) crafted a delicious way to describe how data is transmitted between computers. The ISO standard is called the Seven Layers of the OSI Model, composed of the physical, data link, network, transport, session, presentation, and application layers.

At the lowest level, the Physical layer consists of the actual cables that are used to transfer data. The Data Link layer then consists of the additional low-level error-correction hardware that helps correct bad signals or data errors transferred over the cables. Next, the Network layer can actually transfer the data packets across the entire Internet. The IP protocol lives at this layer of the network stack.

Following the Network layer, the Transport layer provides for ports and packet transfer reliability, in case a packet might be lost at one of the router hops. The TCP and UDP protocols work at this level of the stack.

Finally, the Session, Presentation, and Application layers operate on the operating system level. The Session layer groups multiple network connections into a single session. The presentation layer takes the packets and transforms them into structured data. Finally, the application layer takes the structured data and uses it in a specific program.

As part of the Transport layer, the primary purpose of TCP and UDP is to transmit packets between computers. In the previous analogy with the post office, the IP layer is like the US Postal Service, and is used to send postcards, or packets, across the Internet. Since each packet is limited a small size of 64 kb, programs are required to split their messages into many small packets. For reference, a small photo would take approximately 16 packets to send across the Internet, while the average web page requires a few hundred.

Since one computer could simultaneously have two different network connections open, for instance one to Google and one to Facebook, it needs a way to uniquely mark a stream of packets. Thus the concept of Ports was created. When a computer makes an Internet request, it reserves a new port, and asks the server to send information back on that specific port.

The UDP protocol encapsulates ports and makes sure that they work properly on top of the IP layer. While the IP layer only sends information between actual Internet addresses, the UDP protocol then makes sure the data is sent to the right port. Similar to the Postal Service, the IP layer makes sure the letter is delivered to the right address, while the UDP layer, or the apartment building concierge, will put the letter in the right mailbox.

What is unique about the UDP protocol is its extreme simplicity compared to TCP. The UDP layer has no guarantee of delivery. It also has no guarantees of correct packet order, or techniques to avoid duplication. If you send a letter over UDP, you may not get it at all, or you might get it twice by accident.

These weaknesses, however, also give the UDP protocol its primary strength – it is faster in real-time performance than TCP. This makes it ideal for real-time applications like streaming media, Voice over IP, and online games. Other technologies such as DHCP can also use UDP when they don’t need the full power of the TCP. And despite lacking delivery guarantees, the UDP protocol does have robust error-checking to make sure that if the data does go through, it is not corrupted at the other end.

Characterized primarily by what it’s not, the UDP protocol offers elegance and simplicity in contrast to its heavyweight companion TCP. When an application needs a flexible way to send non-crucial information, the UDP protocol can be the ideal tool for the job.

Join us in the next post where we review the TCP protocol – the foundation of web browsing, email traffic, and most services available on the Internet.

Written by Andrew Palczewski

About the Author
Andrew Palczewski is CEO of apHarmony, a Chicago software development company. He holds a Master's degree in Computer Engineering from the University of Illinois at Urbana-Champaign and has over ten years' experience in managing development of software projects.
Google+

RSS Twitter LinkedIn Facebook Email

One thought on “Networking fundamentals – a dive into the UDP protocol”

  1. Its a terrific blog page I have actually ever before seen, Its
    being surprisingly quoted all the payday loan specifics as per 3rd individual needs.

    I adored it lot personally.

Leave a Reply

Your email address will not be published. Required fields are marked *