# libtmux::Server::control

- **Module:** libtmux::Server
- **Package:** libtmux-cxx
- **Language:** C++
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-cxx/blob/85e8bd603a322dc32bb8b9aeb1a72bcf36945f1d/include/libtmux/server.hpp#L135
- **Page:** https://libtmux.org/reference/cxx/libtmux-server-control/

```
libtmux::Server::control(session: std::string_view) -> expected< Connection, ProtocolError >
```

Open a control-mode connection to one session.

This is the streaming half of the transport: a control connection stays open, exposes guarded reply blocks in wire order, and delivers events outside those blocks. The synchronous surface above is unaffected — a caller who never opens one never pays for it. A guarded block is not a final result for commands whose work tmux completes asynchronously.

Fails with `ProtocolError`, not `CommandFailure`, because that is what the `Connection` it returns speaks: an error type here that the value's own surface does not use would make the doorway disagree with the room.
