---
title: "Examples"
---

> Documentation Index
> Fetch the complete documentation index at: https://openarkstudio.github.io/arknet/llms.txt
> Use this file to discover all available pages before exploring further.

# Examples

The repository includes small C++ applications, and each protocol guide provides
complete client/server programs. Database guides cover clients and pools.
Use the same dependency combination and TLS settings for transport peers.

## Repository applications

| Program | Source | Run |
| --- | --- | --- |
| TCP echo server | [echo_server.cpp](https://github.com/OpenArkStudio/arknet/blob/main/examples/echo_server.cpp) | `build/examples/arknet_echo_server` |
| HTTP echo server | [http_echo_server.cpp](https://github.com/OpenArkStudio/arknet/blob/main/examples/http_echo_server.cpp) | `build/examples/arknet_http_echo_server` |
| IPv6 client/server | [ipv6_echo.cpp](https://github.com/OpenArkStudio/arknet/blob/main/examples/ipv6_echo.cpp) | `build/examples/arknet_ipv6_echo` |
| MySQL client | [mysql_client.cpp](https://github.com/OpenArkStudio/arknet/blob/main/examples/mysql_client.cpp) | `build/examples/arknet_mysql_client` |
| MySQL pool | [mysql_pool.cpp](https://github.com/OpenArkStudio/arknet/blob/main/examples/mysql_pool.cpp) | `build/examples/arknet_mysql_pool` |
| Redis client | [redis_client.cpp](https://github.com/OpenArkStudio/arknet/blob/main/examples/redis_client.cpp) | `build/examples/arknet_redis_client` |
| Redis pool | [redis_pool.cpp](https://github.com/OpenArkStudio/arknet/blob/main/examples/redis_pool.cpp) | `build/examples/arknet_redis_pool` |

Build from the repository root:

```sh
cmake -S . -B build -DARKNET_BUILD_EXAMPLES=ON \
  -DARKNET_USE_BOOST_ASIO=ON -DARKNET_ENABLE_SSL=ON
cmake --build build --parallel 3
```

For Visual Studio, add `--config Release` and run the `.exe` from `examples/Release/`.
Read each program's source for its port and shutdown behavior.
Database examples take an explicit endpoint and a password environment variable;
see [MySQL](/arknet/features/mysql/usage) and [Redis](/arknet/features/redis/usage).

## Protocol pairs

| Protocol | Server | Client |
| --- | --- | --- |
| TCP | [Program](/arknet/features/tcp/server) | [Program](/arknet/features/tcp/client) |
| UDP | [Program](/arknet/features/udp/server) | [Program](/arknet/features/udp/client) |
| WebSocket | [Program](/arknet/features/websocket/server) | [Program](/arknet/features/websocket/client) |
| HTTP | [Program](/arknet/features/http/server) | [Program](/arknet/features/http/client) |
| TLS TCP | [Program](/arknet/features/tls/server) | [Program](/arknet/features/tls/client) |

[HTTPS](/arknet/features/http/configuration) and [WSS](/arknet/features/websocket/configuration)
describe adaptations of the complete programs. Secure examples require OpenSSL
and `ARKNET_ENABLE_SSL=ON`; repository private keys are for local tests only.

Performance executables are under `benchmarks/`; see [measurement methodology](/arknet/performance/methodology).

Source: https://openarkstudio.github.io/arknet/examples/index.mdx
