# LibTmux.Server.CreateOwnedAsync

- **Module:** LibTmux.Server
- **Package:** LibTmux
- **Language:** .NET
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-dotnet/blob/320dc64f4b8b7815842471327a5e6b84a1499bf8/src/LibTmux/Server.Lifecycle.cs#L206
- **Page:** https://libtmux.org/en/dotnet/latest/reference/libtmux-server-createownedasync/

```
LibTmux.Server.CreateOwnedAsync(options: ServerConnectionOptions?, cancellationToken: CancellationToken) -> Task<OwnedServerScope>
```

Starts a server and takes ownership of it.

The scope holds an endpoint rather than a materialized server, because
a tmux server with no sessions exits at once. <see cref="OwnedServerScope.Value" />
stays that endpoint after a session is created through it; its session,
window, and pane listings and <see cref="CaptureSnapshotAsync" />
discover the live server on each call, and the objects they return
carry the discovered handle.

## Parameters

- `options` (ServerConnectionOptions?): Connection options.
- `cancellationToken` (CancellationToken): Cancels the tmux commands.

## Returns

A scope that stops the server when disposed.
