![]() |
jsocketpp 1.0
A cross-platform C++20 socket library.
|
Telemetry data about a single UDP datagram receive operation. More...
#include <DatagramSocket.hpp>
Public Attributes | |
| std::size_t | bytes = 0 |
| Number of bytes successfully copied into the destination buffer. | |
| std::size_t | datagramSize = 0 |
| Full size of the original datagram when it can be determined. | |
| bool | truncated = false |
| Indicates whether datagram truncation occurred. | |
| sockaddr_storage | src {} |
| Raw storage for the sender's address information. | |
| socklen_t | srcLen = 0 |
| Length in bytes of the valid address data in src. | |
Telemetry data about a single UDP datagram receive operation.
The DatagramReadResult structure encapsulates comprehensive details about the result of a UDP datagram receive operation, including payload size, truncation status, and sender information. It enables monitoring and control of datagram handling behavior.
Key features:
| std::size_t jsocketpp::DatagramReadResult::bytes = 0 |
Number of bytes successfully copied into the destination buffer.
This field indicates how many bytes were actually stored in the caller's buffer during the receive operation. If the datagram was larger than the provided buffer capacity and truncation occurred, this value will be less than datagramSize.
| std::size_t jsocketpp::DatagramReadResult::datagramSize = 0 |
Full size of the original datagram when it can be determined.
This field represents the complete size of the received datagram before any truncation, when it can be determined through:
| sockaddr_storage jsocketpp::DatagramReadResult::src {} |
Raw storage for the sender's address information.
This field contains the platform-independent sockaddr_storage structure holding the complete address information of the datagram sender. This is only valid for:
| socklen_t jsocketpp::DatagramReadResult::srcLen = 0 |
Length in bytes of the valid address data in src.
This field indicates how many bytes in the src structure contain valid sender address information. A value of 0 means either:
| bool jsocketpp::DatagramReadResult::truncated = false |
Indicates whether datagram truncation occurred.
Set to true if the incoming datagram was larger than the provided destination buffer's capacity, causing the excess bytes to be discarded. This is a common occurrence in UDP when: