16#include <system_error>
101 class reliable_udp_client :
public std::enable_shared_from_this<reliable_udp_client>
163 std::function<
void(const std::vector<uint8_t>&)> callback) ->
void;
213 auto
client_id() const -> const std::
string&;
auto get_stats() const -> reliable_udp_stats
Returns current connection statistics.
auto start_client(std::string_view host, uint16_t port) -> VoidResult
Starts the client and connects to the target endpoint.
reliable_udp_client(std::string_view client_id, reliability_mode mode=reliability_mode::reliable_ordered)
Constructs a reliable UDP client with specified mode.
auto set_max_retries(size_t retries) -> void
Sets maximum retransmission attempts before giving up.
auto wait_for_stop() -> void
Blocks until the client is stopped.
auto mode() const -> reliability_mode
Returns the current reliability mode.
~reliable_udp_client() noexcept
Destructor. Automatically stops the client if running.
auto send_packet(std::vector< uint8_t > &&data) -> VoidResult
Sends a packet with reliability handling based on mode.
auto set_receive_callback(std::function< void(const std::vector< uint8_t > &)> callback) -> void
Sets callback for received data.
auto set_error_callback(std::function< void(std::error_code)> callback) -> void
Sets callback for connection errors.
auto stop_client() -> VoidResult
Stops the client and releases resources.
auto set_congestion_window(size_t packets) -> void
Sets the congestion window size (maximum unacknowledged packets).
auto client_id() const -> const std::string &
Returns the client identifier.
std::unique_ptr< impl > pimpl_
auto set_retransmission_timeout(uint32_t timeout_ms) -> void
Sets retransmission timeout in milliseconds.
auto is_running() const -> bool
Checks if client is currently running.
Macros and utilities for marking experimental APIs.
#define NETWORK_REQUIRE_EXPERIMENTAL
Enforces opt-in for experimental APIs at compile time.
reliability_mode
Defines the reliability level for UDP packet transmission.
Network-specific error and result type definitions.
Statistics for monitoring reliable UDP connection performance.
uint64_t packets_retransmitted
uint64_t packets_received