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


Public Types | |
| using | endpoint_info = i_udp_client::endpoint_info |
| Reuse endpoint_info from i_udp_client. | |
| 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 (uint16_t port) -> VoidResult=0 |
| Starts the UDP server on the specified port. | |
| virtual auto | stop () -> VoidResult=0 |
| Stops the UDP server. | |
| virtual auto | send_to (const endpoint_info &endpoint, std::vector< uint8_t > &&data, send_callback_t handler=nullptr) -> VoidResult=0 |
| Sends a datagram to the specified endpoint. | |
| 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 server components.
This interface extends i_network_component with UDP server-specific operations such as receiving datagrams from multiple clients and sending responses to specific endpoints.
Definition at line 39 of file i_udp_server.h.
Reuse endpoint_info from i_udp_client.
Definition at line 43 of file i_udp_server.h.
| using kcenon::network::interfaces::i_udp_server::error_callback_t = std::function<void(std::error_code)> |
Callback type for errors.
Definition at line 51 of file i_udp_server.h.
Callback type for received data (includes sender endpoint)
Definition at line 46 of file i_udp_server.h.
| using kcenon::network::interfaces::i_udp_server::send_callback_t = std::function<void(std::error_code, std::size_t)> |
Callback type for send completion.
Definition at line 54 of file i_udp_server.h.
|
nodiscardpure virtual |
Sends a datagram to the specified endpoint.
| endpoint | The 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_server, and kcenon::network::core::unified_udp_messaging_server< TlsPolicy >.
|
pure virtual |
Sets the callback for errors.
| callback | The callback function. |
Implemented in kcenon::network::core::messaging_udp_server, and kcenon::network::core::unified_udp_messaging_server< 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 using send_to().
Implemented in kcenon::network::core::messaging_udp_server, and kcenon::network::core::unified_udp_messaging_server< TlsPolicy >.
|
nodiscardpure virtual |
Starts the UDP server on the specified port.
| port | The port number to bind to. |
Thread-safe. Only one start operation can succeed at a time.
Implemented in kcenon::network::core::messaging_udp_server, and kcenon::network::core::unified_udp_messaging_server< TlsPolicy >.
|
nodiscardpure virtual |
Stops the UDP server.
Thread-safe. Pending operations are cancelled.
Implemented in kcenon::network::core::messaging_udp_server, and kcenon::network::core::unified_udp_messaging_server< TlsPolicy >.