User Datagram Protocol: What role does UDP play in Cellular IoT?
User Datagram Protocol (UDP) is a telecommunication protocol for transferring data over the internet. Learn more about what it is and how it works.
User Datagram Protocol (UDP) is a communication protocol that contrasts with the more standard Transmission Control Protocol (TCP) in several ways. A communications protocol used mainly for loss-tolerating, low-latency connections, UDP allows for data transfers to take place before the receiving party sends an agreement. While TCP is the best solution for most internet-based communication, UDP has a few advantages, particularly for some IoT applications. Let’s take a closer look at what makes UDP different and why its potential to save power and data makes it appealing to device developers.
What is User Datagram Protocol (UDP)?
UDP is faster than TCP, but what it gains in speed it loses in reliability. Because it doesn’t lose time waiting for affirmation, UDP is advantageous for time-sensitive communications like voice over IP (VoIP), video or audio, and Domain Name System (DNS) lookups. UDP makes way for process-to-process communication and uses datagrams to send information, rather than packets. Datagrams are a best-effort communication method and don’t provide any guarantees that the information reached its destination — so UDP is generally less reliable than its sibling, TCP.
What’s the Difference Between UDP and TCP?
TCP is the most frequently used method of transmitting data over the internet. That’s because it boasts the ability to break large quantities of data into smaller packets — and it can detect when a packet doesn’t reach its destination, resending it as needed. These features make TCP a more reliable protocol than UDP, but this more thorough method of packaging and transporting data also makes TCP slower and apt to use larger amounts of data.
UDP, on the other hand, is termed a “connectionless” protocol because it doesn’t wait to establish a virtual circuit before transferring data. Here’s a breakdown of differences between UDP and TCP:
UDP
- Connectionless (doesn’t wait for direct host-to-host connection)
- Faster
- Uses fewer data transfer resources
- May deliver packets out of order
- Packets may be missing, and there’s no way to tell
TCP
- Requires host-to-host connection
- More latency than UDP
- Ensures all packets are delivered in order
- Uses more data transfer resources
How Does UDP work?
Like TCP, UDP works over IP to send datagrams from one computer to another. First, it collects data in a UDP packet and then encloses that within an IP packet for sending, including header data about sending and receiving ports, packet length, and checksum. As we’ve noted, UDP doesn’t guarantee a packet’s delivery — so it doesn’t establish a direct connection with the receiving computer. Instead, it sends the data out in hopes the machines between it and its destination will help it get there — much like addressing a letter and sending it through the mail.
While UDP may sound like a risky choice in comparison to TCP, it has clear advantages for certain situations, including IoT applications where field devices need to conserve battery power. Let’s consider a few benefits of UDP:
Low Latency
UDP uses a simpler method of data transmission that doesn’t rely on handshaking or packet ordering. Because it doesn’t have to wait for these checks, it packages and sends data more quickly than TCP, making it a good choice for time-sensitive applications like streaming video and audio where an occasional lost packet of data isn’t a huge problem.
Conserves Power
Because it doesn’t spend as much time and energy preparing data for transmission, UDP uses less power — which is great news if its sending device is reliant on battery power.
Small Packet Size
UDP uses a small packet size with a small (8 byte) header. This economizing means packets take less time to produce and require less memory to process.
What Role Does UDP Play in Cellular IoT?
While TCP is the dominant protocol in IoT, as in all internet-based communication, UDP offers some advantages to device developers. Let’s consider a few IoT applications for this technology.
Low Power Applications
Many low-power IoT devices, such as smart agriculture sensors, are on strict operational cycles and send data packets on a regular schedule, going into sleep mode between transmissions. In these scenarios, losing a packet of data on one transmission isn’t a big deal because the device will send it again at the next transmission time. In this case, UDP is a good option because it minimizes the device’s “awake” time — it can wake up, send the data, and go back to sleep without waiting for confirmations from the receiving host.
IoT Devices on LLNs
Many IoT devices use low power and lossy networks (LLNs) with power, memory, and processing resources that are extremely limited. Developed to help these devices operate, the Constrained Application Protocol (CoAP) runs on UDP devices.
UDP and Security
Security is always a concern in IoT, and UDP unfortunately adds additional risks of cyber attack. Because it doesn’t first establish an authenticated connection with a host before transferring data, UDP makes it easier for bad actors to intercept packets and tamper with them.
Botnets use UDP to carry out Distributed Denial of Service (DDoS) attacks, flooding a server with datagrams and generating an overwhelming number of Internet Control Message Protocol (ICMP) response messages. The tsunami of data traffic and the need to respond can overwhelm the victimized server, causing service interruptions for legitimate users.
To guard against the security vulnerabilities inherent in UDP, IoT developers can utilize Datagram Transport Layer Security (DTLS). Based on Transport Layer Security (TLS), DTLS provides privacy for datagram transfer and prevents eavesdropping, tampering, and unauthorized access.
Other IoT security best practices such as multiple firewalls and private networks (or VPNs) also guard against UDP attacks, helping to minimize security risks if you choose UDP.
Cellular IoT with Hologram
At Hologram, we’re committed to helping you achieve a secure IoT deployment, whether your devices use UDP or TCP. Test-drive Hologram with a free global IoT SIM and get connected in no time without negotiations, contracts, or headaches.