Introduction
A telemetry sender can put one sample in one UDP datagram. The receiving application gets a message boundary it can interpret immediately, but it must decide how to handle missing, duplicated or late samples.
Send one message at a time
UDP adds source and destination ports, a length and a checksum to a message. It requires no transport handshake. Each delivered datagram retains its boundary. An application with a receive buffer too small for a message can encounter truncation according to its socket interface.
UDP supplies no sequencing, retransmission or congestion controller of its own. A protocol built on it can supply those mechanisms. QUIC, for example, provides reliable streams above UDP. Timeliness-sensitive applications can instead choose to discard stale data.
Check the length and integrity
For an ordinary datagram, length equals eight header bytes plus data bytes. The checksum includes a pseudo-header derived from IP, the UDP header and the data. An omitted checksum is representable in IPv4. IPv6 ordinarily requires the UDP checksum, with narrowly specified exceptions.
A valid checksum helps detect transit errors and mismatched addressing. It does not authenticate a sender. Applications needing authenticated messages should select a protocol that provides that property.
Plan for the packet path
An application’s configured maximum message size should account for every header within the path MTU. Losing one IP fragment prevents successful reassembly of the complete datagram. A smaller supported message size can avoid fragmentation.
For periodic samples, place a sequence counter or timestamp in the application data when the receiver needs to identify gaps. The application’s specification should define how it treats late arrivals and counter rollover.
Diagram
- Telemetry sample · 120 B
- UDP datagram · 128 B
- IPv6 packet · 168 B
- Receiver reads one sample
Worked examples
Size a sample and interpret its arrival
- Encode 120 bytes of sample data, including an application sequence counter. The UDP length is 8 + 120 = 128 bytes.
- Add 40 IPv6 bytes. The IP packet is 168 bytes, well within a 1280-byte path budget under these assumptions.
- At the collector, samples 41 and 43 arrive before 42. Their application counters reveal the reordering. UDP assigns no delivery deadline or recovery policy.
MTU Calculator: Fit TCP data and options in a 1500-byte IPv4 packet
- Choose a 1500-byte IP MTU and IPv4 with TCP. The base headers take 20 + 20 = 40 bytes, leaving 1460 bytes.
- Suppose this packet carries 12 more bytes of TCP options and padding. Enter 12 as additional overhead.
- The data budget is 1448 bytes. Reassemble the packet on paper: 20 bytes of IPv4 + 32 bytes of TCP + 1448 bytes of data = 1500.
Reference table
| UDP header field | Size | Meaning |
|---|---|---|
| Source port | 16 bits | Sender endpoint or zero if unused under the protocol rules |
| Destination port | 16 bits | Recipient service endpoint |
| Length | 16 bits | Header plus payload for ordinary datagrams |
| Checksum | 16 bits | Ones’ complement checksum including the IP pseudo-header |
Configuration example
- On a telemetry collector worksheet record the destination address, UDP port, maximum sample length and expected reporting interval. Match each sender to that message format.
- Choose an application policy for missed samples. A periodic instrument may keep newer readings, whereas a transaction protocol may require request identifiers, retries and duplicate suppression.
Common mistakes
- Subtracting just eight bytes from an IP MTU while forgetting the IP header.
- Treating the absence of a transport handshake as evidence that the remote application is ready.
Frequently asked questions
Can UDP carry a zero-byte message?
Yes. An ordinary UDP datagram with no application data has a length of eight bytes.
Is UDP always faster than TCP?
The workloads have different requirements. If the application needs retries and ordering, those mechanisms still consume time and capacity wherever they are implemented.
Does UDP guarantee delivery or ordering?
No. UDP sends datagrams without TCP's connection setup, retransmission, or ordered byte-stream guarantees. An application can add its own reliability if needed.
Why might an application use UDP?
It may need datagram boundaries, low setup overhead, multicast behavior, or custom loss handling. The application must decide whether and how to recover missing data.
Does a UDP checksum always exist in IPv4 and IPv6?
IPv6 requires a UDP checksum except for narrowly specified tunnel cases; IPv4 permits a zero checksum for UDP. Receivers and application requirements still matter.
Can UDP use a familiar service port?
Yes. Port numbers are interpreted together with transport protocol. TCP port 53 and UDP port 53 are distinct endpoints even though both are associated with DNS use.
Does UDP preserve one send as one receive?
UDP preserves datagram boundaries when a datagram is delivered, but delivery is not guaranteed. The application must handle missing, duplicated, late, or reordered datagrams as needed.
Is QUIC carried over UDP?
Yes. QUIC uses UDP datagrams as its substrate while implementing transport features and TLS-based security above UDP. That does not make plain UDP itself reliable or encrypted.
Should every UDP application ignore congestion?
No. Applications sending sustained traffic still need appropriate congestion behavior and rate control. UDP's minimal transport service does not remove that responsibility.
Can a UDP datagram be fragmented?
An IP packet carrying UDP can encounter fragmentation or path-MTU constraints. Applications that send large datagrams should consider the path size and loss cost of fragmentation.
What does the UDP length field include?
It counts the UDP header and UDP payload. The UDP header is eight bytes, and the enclosing IP packet has its own length accounting.
Why can a large UDP datagram be risky?
It can exceed the path MTU and be fragmented or dropped. Losing one IP fragment can make the whole UDP datagram unusable, so applications often keep datagrams small.
Why might DNS switch from UDP to TCP?
A resolver can retry over TCP when a UDP response is truncated or when TCP is otherwise required. Firewall rules that permit only UDP can therefore break some DNS operations.
Does UDP checksum detect every possible corruption?
It detects many transmission errors but is not cryptographic authentication and can have a finite undetected error probability. Secure applications need appropriate cryptographic integrity protection.
Does QUIC make UDP delivery reliable?
QUIC implements its own transport reliability, congestion behavior, and encryption above UDP. Those features belong to QUIC, not to the UDP service itself.

