idfxx 1.0.0
Modern C++23 components for ESP-IDF
Loading...
Searching...
No Matches
idfxx::net::datagram Struct Reference

A datagram received together with the sender's endpoint. More...

Public Attributes

std::span< std::byte > data
 Filled portion of the caller's receive buffer (aliases it).
 
endpoint from
 Source endpoint of the datagram.
 
bool truncated = false
 True if the datagram was larger than the buffer; data holds the leading portion and the remainder was discarded.
 

Detailed Description

A datagram received together with the sender's endpoint.

Returned by try_recv_from on connectionless sockets and netconn connections. data is a sub-span of the buffer the caller passed in, sized to the bytes actually copied. If the datagram was larger than the buffer, truncated is set and the excess bytes are discarded (datagrams cannot be read in pieces).

Warning
data aliases the caller's receive buffer — it does not own its storage and is valid only as long as that buffer remains alive and unmodified.

Definition at line 228 of file endpoint.hpp.

Member Data Documentation

◆ data

std::span<std::byte> idfxx::net::datagram::data

Filled portion of the caller's receive buffer (aliases it).

Definition at line 229 of file endpoint.hpp.

◆ from

endpoint idfxx::net::datagram::from

Source endpoint of the datagram.

Definition at line 230 of file endpoint.hpp.

◆ truncated

bool idfxx::net::datagram::truncated = false

True if the datagram was larger than the buffer; data holds the leading portion and the remainder was discarded.

Definition at line 233 of file endpoint.hpp.


The documentation for this struct was generated from the following file: