# io.github.libtmux.kotlin.withControl

- **Module:** io.github.libtmux.kotlin
- **Package:** io.github.libtmux:libtmux-kotlin
- **Language:** Kotlin
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-java/blob/f56392b5d9bc7f1f9c1631842333fb90f3d82d40/libtmux-kotlin/src/main/kotlin/io/github/libtmux/kotlin/Scopes.kt#L30
- **Page:** https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-withcontrol/

```
public suspend fun <R> withControl(
    server: Server,
    session: Session,
    timeout: Duration = server.config.defaultTimeout().toKotlinDuration(),
    block: suspend (ControlClient) -> R,
): R
```

As [withServer], for a [ControlClient] attached through [server].

## Parameters

- `server` (`Server`)
- `session` (`Session`)
- `timeout` (`Duration`)
- `block` (`suspend`)
