|
Network System 0.1.1
High-performance modular networking library for scalable client-server applications
|
Interface for UDP client components. More...
#include <i_udp_client.h>


Classes | |
| struct | endpoint_info |
| Endpoint information for UDP datagrams. More... | |
Public Types | |
| using | receive_callback_t |
| Callback type for received data (includes sender endpoint) | |
| using | error_callback_t = std::function<void(std::error_code)> |
| Callback type for errors. | |
| using | send_callback_t = std::function<void(std::error_code, std::size_t)> |
| Callback type for send completion. | |
Public Member Functions | |
| virtual auto | start (std::string_view host, uint16_t port) -> VoidResult=0 |
| Starts the UDP client targeting the specified endpoint. | |
| virtual auto | stop () -> VoidResult=0 |
| Stops the UDP client. | |
| virtual auto | send (std::vector< uint8_t > &&data, send_callback_t handler=nullptr) -> VoidResult=0 |
| Sends a datagram to the configured target endpoint. | |
| virtual auto | set_target (std::string_view host, uint16_t port) -> VoidResult=0 |
| Changes the target endpoint for future sends. | |
| virtual auto | set_receive_callback (receive_callback_t callback) -> void=0 |
| Sets the callback for received datagrams. | |
| virtual auto | set_error_callback (error_callback_t callback) -> void=0 |
| Sets the callback for errors. | |
Public Member Functions inherited from kcenon::network::interfaces::i_network_component | |
| virtual | ~i_network_component ()=default |
| Virtual destructor for proper cleanup of derived classes. | |
| i_network_component (const i_network_component &)=delete | |
| i_network_component & | operator= (const i_network_component &)=delete |
| i_network_component (i_network_component &&)=delete | |
| i_network_component & | operator= (i_network_component &&)=delete |
Additional Inherited Members | |
Protected Member Functions inherited from kcenon::network::interfaces::i_network_component | |
| i_network_component ()=default | |
| Default constructor (only for derived classes) | |
| virtual auto | is_running () const -> bool=0 |
| Checks if the component is currently running. | |
| virtual auto | wait_for_stop () -> void=0 |
| Blocks until the component has stopped. | |
Interface for UDP client components.
This interface extends i_network_component with UDP-specific operations such as connectionless datagram transmission and receiving datagrams with sender endpoint information.
Definition at line 43 of file i_udp_client.h.
| using kcenon::network::interfaces::i_udp_client::error_callback_t = std::function<void(std::error_code)> |
Callback type for errors.
Definition at line 59 of file i_udp_client.h.
Callback type for received data (includes sender endpoint)
Definition at line 54 of file i_udp_client.h.
| using kcenon::network::interfaces::i_udp_client::send_callback_t = std::function<void(std::error_code, std::size_t)> |
Callback type for send completion.
Definition at line 62 of file i_udp_client.h.
|
nodiscardpure virtual |
Sends a datagram to the configured target endpoint.
| data | The data to send. |
| handler | Optional completion handler. |
Thread-safe. Multiple sends may be queued.
Implemented in kcenon::network::core::messaging_udp_client, and kcenon::network::core::unified_udp_messaging_client< TlsPolicy >.
|
pure virtual |
Sets the callback for errors.
| callback | The callback function. |
Implemented in kcenon::network::core::messaging_udp_client, and kcenon::network::core::unified_udp_messaging_client< TlsPolicy >.
|
pure virtual |
Sets the callback for received datagrams.
| callback | The callback function. |
The callback receives both the data and the sender's endpoint information, allowing responses to be sent to the correct peer.
Implemented in kcenon::network::core::messaging_udp_client, and kcenon::network::core::unified_udp_messaging_client< TlsPolicy >.
|
nodiscardpure virtual |
Changes the target endpoint for future sends.
| host | The new target hostname or IP address. |
| port | The new target port number. |
Thread-safe.
Implemented in kcenon::network::core::messaging_udp_client, and kcenon::network::core::unified_udp_messaging_client< TlsPolicy >.
|
nodiscardpure virtual |
Starts the UDP client targeting the specified endpoint.
| host | The target hostname or IP address. |
| port | The target port number. |
Thread-safe. Only one start operation can succeed at a time.
Implemented in kcenon::network::core::messaging_udp_client, and kcenon::network::core::unified_udp_messaging_client< TlsPolicy >.
|
nodiscardpure virtual |
Stops the UDP client.
Thread-safe. Pending operations are cancelled.
Implemented in kcenon::network::core::messaging_udp_client, and kcenon::network::core::unified_udp_messaging_client< TlsPolicy >.