|
Network System 0.1.1
High-performance modular networking library for scalable client-server applications
|
Focused, minimal examples demonstrating common network_system usage patterns. Each example is self-contained and can be built and run independently.
For more comprehensive demonstrations (HTTP, gRPC, QUIC, memory profiling), see the samples/ directory.
Examples are built when BUILD_EXAMPLES=ON is set (off by default):
Binaries are placed in build/bin/examples/.
A minimal TCP server that echoes received data back to the client. Shows server lifecycle, session tracking, and callback-based event handling.
A TCP client that connects to a server, sends text and binary messages, and prints responses. Pair with tcp_echo_server.
A self-contained WebSocket chat demo. Starts a server and two clients in separate threads, demonstrating broadcast messaging over WebSocket.
Requires BUILD_WEBSOCKET_SUPPORT=ON (enabled by default).
Demonstrates TCP connection pooling with the tcp_facade. Covers pool initialization, single-threaded acquire/release, and multi-threaded concurrent access with throughput measurement.
A UDP echo server and client running in a single program. Shows datagram-based communication with message boundary preservation.
Demonstrates the connection_observer interface, null_connection_observer, and callback_adapter for handling client events. Compares the observer pattern with callback-based approaches.
| Concept | Examples |
|---|---|
| TCP server/client | tcp_echo_server, tcp_client |
| UDP communication | udp_echo |
| WebSocket | websocket_chat |
| Connection pooling | connection_pool |
| Observer pattern | observer_pattern |
| Result<T> error handling | All examples |
| Session management | tcp_echo_server, websocket_chat |
| Facade API | All examples |
All examples use the facade API (tcp_facade, udp_facade, websocket_facade) which provides a simplified interface for creating clients and servers. The facade returns i_protocol_client and i_protocol_server interfaces that offer a consistent API across all protocols.