|
Network System 0.1.1
High-performance modular networking library for scalable client-server applications
|
Example showing the new unified server (listener) interface usage. More...
#include <kcenon/network/protocol/protocol.h>#include <kcenon/network/unified/unified.h>#include <cstddef>#include <iostream>#include <map>#include <memory>#include <span>#include <string>
Go to the source code of this file.
Classes | |
| class | ConnectionManager |
| Advanced example: Managing accepted connections. More... | |
Functions | |
| void | setup_server (std::unique_ptr< unified::i_listener > listener) |
| Protocol-agnostic server setup. | |
| void | tcp_server_example () |
| TCP server example using unified API. | |
| void | udp_server_example () |
| UDP server example using unified API. | |
| void | websocket_server_example () |
| WebSocket server example using unified API. | |
| std::unique_ptr< unified::i_listener > | create_listener (const std::string &protocol, uint16_t port) |
| Example of protocol selection at runtime. | |
| int | main () |
Example showing the new unified server (listener) interface usage.
This file demonstrates the NEW, RECOMMENDED way of creating network servers using the unified interface API.
Benefits:
Definition in file unified_server_example.cpp.
| std::unique_ptr< unified::i_listener > create_listener | ( | const std::string & | protocol, |
| uint16_t | port ) |
Example of protocol selection at runtime.
Definition at line 160 of file unified_server_example.cpp.
References kcenon::network::protocol::tcp::listen(), kcenon::network::protocol::udp::listen(), and kcenon::network::protocol::websocket::listen().

| int main | ( | ) |
Definition at line 175 of file unified_server_example.cpp.
| void setup_server | ( | std::unique_ptr< unified::i_listener > | listener | ) |
Protocol-agnostic server setup.
This function works with ANY protocol - TCP, UDP, WebSocket, QUIC. The unified interface enables truly protocol-agnostic server code.
Definition at line 40 of file unified_server_example.cpp.
Referenced by tcp_server_example(), udp_server_example(), and websocket_server_example().

| void tcp_server_example | ( | ) |
TCP server example using unified API.
Definition at line 73 of file unified_server_example.cpp.
References kcenon::network::protocol::tcp::listen(), and setup_server().

| void udp_server_example | ( | ) |
UDP server example using unified API.
Definition at line 84 of file unified_server_example.cpp.
References kcenon::network::protocol::udp::listen(), and setup_server().

| void websocket_server_example | ( | ) |
WebSocket server example using unified API.
Definition at line 95 of file unified_server_example.cpp.
References kcenon::network::protocol::websocket::listen(), and setup_server().
