What is the User Datagram Protocol (UDP) and How Does it Work?

What is the User Datagram Protocol (UDP) and how does it compare to TCP?

What is the User Datagram Protocol (UDP)?

Introduction

The User Datagram Protocol (UDP) is one of the most common ways data on the Internet is transmitted. UDP is often discussed alongside another commonly used communication protocol: the transmission control protocol (TCP). UDP and TCP both have their strengths and weaknesses, and they are used in different situations to maximize their strengths and minimize their downsides.

How UDP works

Different protocols for transmitting data over the Internet operate at different layers of the open systems interconnection (OSI) seven-layer model. Like the TCP, UDP also operates at the transport layer. Conceptually, transmitting data using UDP is similar to TDP: data must first be divided into small individual units called protocol data units (PDUs) before the units are transmitted over the Internet through the process of routing.

What Is User Datagram Protocol (UDP) and how does it work

The PDU for UDP is the datagram. Instead of dividing data into packets (which is the PDU for TCP), data transmitted using UDP is divided into datagrams which are then routed over the Internet and received on the receiver’s end.

UDP is a connectionless protocol. Unlike the TCP which first requires a connection to be established using the three-way SYN, SYN-ACK, and ACK handshake before packets can be transmitted, UDP does not require the establishment of any connection between the sending and receiving machines. Once the receiving machine makes a request to the sending machine, the sending machine will continuously send datagrams over without establishing any connection.

Benefits of UDP

The main benefit of UDP is reduced latency between the transmission of individual units of data. In UDP, these units are called datagrams. For TCP, for each unit of data (i.e. packets), an acknowledgement receipt needs to be sent back to the sender, which increases the delay between transmission of packets. UDP minimizes this delay because it sends datagrams continuously, one after another, to the receiver without requiring the receiver to acknowledge receipt of the datagrams.

Drawbacks of UDP

Unlike TCP, which uses ACK packets to track data's movement, UDP doesn't require acknowledgement receipts. This means that if datagrams are lost in transit, there's no record of how many are sent or when they arrived.

Let’s use a simple analogy to illustrate. Instead of transmitting the contents of a file over the Internet, let’s say you want to send all the contents of your old house to your new overseas apartment because you have migrated. You ask your brother to help you to send all the items in your old house over to your new apartment.

Your brother goes to your old house, packs up every item individually and drops everything off at a cheap courier company that doesn't provide tracking. Because the courier is cheap, its workers don't bother about the order in which the items are dropped off.

The workers pick up the items from the company's front door and pass them on to third-party delivery contractors with only one instruction: send the items as fast as possible. Packages pile up on your doorstep, but you have no idea how many were sent or when they arrive because there's no acknowledgement receipt.

As a result, you get your items really quickly at your new home, but if something goes missing, you may not even know because you have no idea how many items to expect. You probably received almost everything, but if anything gets lost you have no way of knowing or tracking it down.

Did you find this article helpful?

0 out of 0 Bunnies found this article helpful

Glossary

Layer 4 (Transport Layer)

The layer of the OSI model that handles traffic between hosts and clients (TCP/UDP).

UDP

User Datagram Protocol.

OSI

Open Systems Interconnection Model. A seven-layer model that describes how different parts of networks function.

Prove your Knowledge.
Earn a bunny diploma.

Test your knowledge in our Junior and Master Quizes to see where you stand. Prove your mastery by getting A+ and recieving a diploma.

Start the QuizBunny with a diploma.