> For the complete documentation index, see [llms.txt](https://xrho.gitbook.io/rho/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xrho.gitbook.io/rho/daemons/rhod.md).

# The rhod Binary

## What is rhod?

`rhod` (Rho Daemon) is the standalone binary that runs a Rho gateway. It reads configuration from the filesystem, creates a Gateway with a Bind, and enters the main loop.

## Building

```bash
cd rho
mkdir build && cd build
cmake ..
make rhod
```

The binary is at `build/rhod`.

## Running

```bash
# Start with default config directory
./rhod /etc/rho 0.0.0.0:9000

# Start with custom paths
./rhod /home/user/.rho 192.168.1.100:8080
```

Arguments:

1. **Config directory** — Path to the configuration files (identity, routes, upgrades)
2. **Bind address** — UDP address and port to listen on

## What It Does

On startup, `rhod`:

1. Reads the identity (keypair + address) from `<config>/identity/`
2. Reads the route claims from `<config>/routes/`
3. Reads the upgrade targets from `<config>/upgrades/`
4. Creates a `Bind` on the specified address
5. Creates a `DaemonHost` with the loaded configuration
6. Enters the main loop: `bind.update()` → `host.update()` → `usleep(1000)`

## Process Model

`rhod` is single-threaded. It runs one event loop. All I/O is non-blocking. There are no worker threads, no thread pools, no async runtimes.

This is deliberate. A single `rhod` instance can handle thousands of concurrent tunnels on a single core. If you need more throughput, run multiple `rhod` instances on different ports (or use SO\_REUSEPORT).

## Signals

* `SIGTERM` / `SIGINT` — Graceful shutdown. Cleans up all tunnels and exits.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://xrho.gitbook.io/rho/daemons/rhod.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
