Transport Protocols · Study deck

User Datagram Protocol (UDP)

Picture a greenhouse node sending soil status every thirty seconds.

Packet Pete is your guide for this deck.

datagramstransport-layercoap
Packet Pete, the module guide, in a scene from this chapter.
iotclass.org

After studying this chapter

Learning objectives

You will be able to:

  • Explain: Protected UDP paths need a separate security review, often at the application or DTLS layer, and commands with side effects need acknowledgement, identifiers, idempotent handling, or a clear failure policy above UDP.
  • Explain: If packet 181 is missing but packet 182 arrives within the dashboard freshness window, the receiver can show the newer value and mark the older sample as skipped.
  • Explain: It adds source port, destination port, length, and checksum information to application data, then sends each message as an independent datagram without first creating a transport session.
  • explain UDP datagrams, ports, length, and checksum behavior
iotclass.org

Major section

Start With One Datagram

Most readings can be replaced by the next one, but a valve command cannot.

  • The product owner must decide which messages may be lost, late, repeated, or out of order before choosing the light send-and-forget path.
  • Reachability alone does not prove trust.
  • This opening does not choose the right transport for every message.
iotclass.org

Major section

Start With One Datagram (continued)

A distant store may collect trends, but it must not be the only place that knows whether a valve may open.

  • Practitioner writes and tests the receiver contract.
  • Under the Hood examines checksums, ports, message size, loss, ordering, repair, and the security work that sits above the small datagram boundary.
  • UDP makes that send cheap, but it also leaves delivery, ordering, retry, and acceptance decisions outside the transport itself.
iotclass.org

Major section

Overview: UDP Is a Datagram Boundary

UDP is a connectionless transport protocol.

  • It adds source port, destination port, length, and checksum information to application data, then sends each message as an independent datagram without first creating a transport session.
  • That small transport boundary can be a good fit for IoT traffic when each message has bounded meaning.

Why it matters

The same node's irrigation command would need a different record, because a missed, repeated, or late command can change equipment state.

UDP is a small send-and-forget datagram boundary - no handshake, no acknowledgement, no ordering - so the application owns reliability.
UDP is a small send-and-forget datagram boundary - no handshake, no acknowledgement, no ordering - so the application owns reliability.
iotclass.org

Major section

Overview: UDP Is a Datagram Boundary (continued)

A routine reading can often be replaced by the next reading.

  • A discovery request may need to reach more than one local endpoint.
  • An application protocol such as CoAP can add acknowledgement behavior only where it is needed.
  • UDP therefore works best when the review names the message consequence.
iotclass.org

Major section

Overview: UDP Is a Datagram Boundary (continued)

For example, a greenhouse node might send soil-moisture status every 30 seconds with a sample time and sequence number.

  • If packet 181 is missing but packet 182 arrives within the dashboard freshness window, the receiver can show the newer value and mark the older sample as skipped.
  • Replaceable telemetry, local discovery, and one-shot diagnostic events often have tolerances that can be written down.
  • The review question is not whether UDP is simple.
iotclass.org

Major section

Overview: UDP Is a Datagram Boundary (continued)

Commands, alarms, billing records, and audit events usually need acknowledgement, identifiers, replay controls, or a different transport pattern.

  • The review question is whether the application record explains what happens when a datagram is missing, duplicated, delayed, stale, or untrusted.
  • UDP's appeal and its limit are easiest to see in one exchange.
  • The small header and independent message boundary reduce transport work, but loss, ordering, duplication, backoff, and application confirmation remain outside that promise.
iotclass.org

Major section

Practitioner: Write the Receiver Contract

The contract also needs an owner.

  • The same device can use UDP for routine status while using a different acknowledgement path for commands, configuration, or firmware transfer.
  • A practical contract should be testable from both sides of the path.
  • If the operator accepts loss for a dashboard-only flow, the monitoring system owns the stale-data alarm.
iotclass.org

Major section

Practitioner: Write the Receiver Contract (continued)

For a parking-space sensor, the sender record might show datagram ID, sample time, payload schema, destination service, and retry timer.

  • Freshness rule, duplicate handling, sequence or identifier use, acknowledgement rule, and idempotent action.
  • Assuming the receiver will infer intent from arrival alone.
  • Security layer, peer identity, replay handling, retry limits, and change triggers.
iotclass.org

Major section

Under the Hood: What UDP Does Not Promise

UDP provides port multiplexing, a datagram boundary, length information, and checksum-based corruption detection.

  • The checksum is not a security boundary.
  • Protected UDP paths need a separate security review, often at the application or DTLS layer, and commands with side effects need acknowledgement, identifiers, idempotent handling, or a clear failure policy above UDP.

Why it matters

Backoff owner Name what prevents retries, discovery responses, or bursty telemetry from creating congestion or receiver overload.

Constrained protocol stack separating CoAP application semantics, UDP or TCP delivery, DTLS security, IPv6 packet scope, and RPL routing.
Constrained protocol stack separating CoAP application semantics, UDP or TCP delivery, DTLS security, IPv6 packet scope, and RPL routing.
iotclass.org

Major section

Under the Hood: What UDP Does Not Promise (continued)

Arrival: a high-rate datagram stream reaches open and closed UDP ports.

  • A receiver may parse the datagram and still reject it as stale, unauthenticated, duplicated, outside a safety window, or inconsistent with the current device state.
  • Under-the-hood review should therefore ask which field carries identity or freshness, which check rejects repeats, and where rejected datagrams are logged.
  • The Boundary rule blocks a DTLS claim from being reused as reliability evidence.
iotclass.org

Major section

Under the Hood: What UDP Does Not Promise (continued)

Backoff owner Name what prevents retries, discovery responses, or bursty telemetry from creating congestion or receiver overload.

  • A burst of retries, discovery responses, or telemetry reports can overload a gateway even though each datagram is individually small.
  • The design evidence should name rate limits, retry backoff, multicast response spreading, queue policy, or alarm behavior.
  • If nobody owns those controls, the UDP decision is incomplete even when every single datagram format is valid.
iotclass.org

Major section

Under the Hood: What UDP Does Not Promise (continued)

In the classic closed-port pattern, an attacker sends datagrams across many destination ports, often with a forged source address.

  • The host must inspect each datagram; for a closed port, the IP layer may generate an ICMP Port Unreachable response toward the forged address.
  • Closed-port response: policy may emit ICMP Destination Unreachable, Port Unreachable; ICMP rate limiting can bound but not erase the inbound cost.
  • Likewise, DTLS can reject unauthenticated application data, but the receiver still spends network and cryptographic work reaching that decision.
iotclass.org

Major section

Summary

UDP is a deliberately small transport protocol.

  • It gives applications ports, datagram boundaries, length, and checksum behavior without creating a reliable ordered stream.
  • That makes UDP useful for bounded IoT messages, discovery traffic, and application protocols that own their own acknowledgement or retry behavior.
  • For review, the important evidence is the receiver contract: message meaning, freshness, duplicate handling, retry ownership, protection boundary, operational visibility, and retest triggers.
iotclass.org

Deck summary

Key takeaways

Most readings can be replaced by the next one, but a valve command cannot.

  • A distant store may collect trends, but it must not be the only place that knows whether a valve may open.
  • UDP is a connectionless transport protocol.
  • A routine reading can often be replaced by the next reading.
  • For example, a greenhouse node might send soil-moisture status every 30 seconds with a sample time and sequence number.
iotclass.org

Retrieval practice

Recall check 1 of 3

Packet Pete says: answer from memory, then check your reasoning.

Q1Which claim is strong enough to justify UDP for an IoT status-reading path?

AThe record explains what missing, duplicated, delayed, or stale readings mean and which layer handles retry or validation
BThe payload is small, but the record omits freshness, duplicate, retry, validation, and receiver-state rules
CThe destination port is visible, so authorization is proven
DThe sender uses UDP, so ordering and delivery are guaranteed
Show answer

Answer: A A useful UDP decision names the message meaning, acceptable failure behavior, receiver responsibility, and review trigger.

iotclass.org

Retrieval practice

Recall check 2 of 3

Packet Pete says: answer from memory, then check your reasoning.

Q2A gateway sometimes receives duplicated UDP readings because the application retries above UDP. What should the design record show?

AThat UDP will suppress duplicate datagrams before the application sees them
BThat a visible source port proves the readings are trustworthy
CIdentify duplicates, apply freshness rules, and avoid counting retries as new events
DThat retries are unnecessary because UDP has built-in retransmission
Show answer

Answer: C When retry behavior sits above UDP, receiver-side duplicate handling and freshness rules become part of the design evidence.

iotclass.org

Retrieval practice

Recall check 3 of 3

Packet Pete says: answer from memory, then check your reasoning.

Q3A UDP command must not create duplicate side effects if a retry occurs. Which design evidence is most important?

AA checksum, because it authenticates the sender and prevents replay
BA destination port, because it confirms the command was applied exactly once
CSpace retries farther apart so the receiver can finish the command before the next datagram arrives
DUse command IDs, acknowledgements, idempotent handling, and a failure policy above UDP
Show answer

Answer: D Side-effecting UDP commands need application-level evidence for acknowledgement, identifiers, idempotency, duplicate handling, and failure behavior.

iotclass.org

Print reference

Answers

Answer key.

  1. A · A useful UDP decision names the message meaning, acceptable failure behavior, receiver responsibility, and review trigger.
  2. C · When retry behavior sits above UDP, receiver-side duplicate handling and freshness rules become part of the design evidence.
  3. D · Side-effecting UDP commands need application-level evidence for acknowledgement, identifiers, idempotency, duplicate handling, and failure behavior.
iotclass.org