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.

How UDP works

Different protocols for transmitting data over the internet operate at different layers of the Open Systems Interconnection (OSI) seven-layer model. TCP and UDP operate at the transport layer. Conceptually, transmitting data using UDP is similar to TDP: data is first divided into small individual units called Protocol Data Units (PDUs) before the units are routed over the internet.

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 to the receiver.

UDP is a connectionless protocol. Unlike TCP which first requires a connection to be established using the three-way SYN, SYN-ACK, and ACK handshake before packets are transmitted, UDP does not require an established 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 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. Let’s say you want to send all the contents of your old house to your new overseas apartment. 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. You have no idea how many were sent or when they arrived because there's no acknowledgement receipt.

As a result, you get your items really quickly but you may not know if there are missing items because you have no idea how many items to expect. You probably received almost everything, but you have no way of knowing what was lost 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.