Common System 0.2.0
Common interfaces and patterns for system integration
Loading...
Searching...
No Matches
kcenon::common::concepts::UdpSender Concept Reference

A type that can send UDP datagrams. More...

#include <transport.h>

Concept definition

template<typename T>
concept kcenon::common::concepts::UdpSender = requires(T t,
std::span<const uint8_t> data,
const interfaces::udp_endpoint& endpoint) {
{ t.send(data) };
{ t.send_to(data, endpoint) };
}
A type that can send UDP datagrams.
Definition transport.h:174

Detailed Description

A type that can send UDP datagrams.

Types satisfying this concept can send data via UDP, either to a connected endpoint or to a specified endpoint.

Example usage:

template<UdpSender U>
void send_metric(U& client, const std::string& data) {
auto bytes = std::span<const uint8_t>(
reinterpret_cast<const uint8_t*>(data.data()),
data.size());
client.send(bytes);
}

Definition at line 174 of file transport.h.