# LibTmux.PsmuxServer.GetWindowsAsync

- **Module:** LibTmux
- **Package:** LibTmux
- **Language:** C#
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-dotnet/blob/cf34b255c896d19a97e7d7fabea58609c916012d/src/LibTmux/Psmux/PsmuxServer.cs#L113
- **Page:** https://libtmux.org/en/csharp/latest/reference/libtmux-psmuxserver-getwindowsasync/

```
LibTmux.PsmuxServer.GetWindowsAsync(cancellationToken: CancellationToken) -> Task<IReadOnlyList<PsmuxWindow>>
```

Reads every window in the sole session.

## Parameters

- `cancellationToken` (`CancellationToken`): Cancels the psmux query.

## Returns

Current immutable window observations.

## Raises

- [`InvalidOperationException`](https://learn.microsoft.com/dotnet/api/system.invalidoperationexception): The selected namespace has no live session.
- [`StaleServerGenerationException`](/en/csharp/latest/reference/libtmux-staleservergenerationexception/): The sole session was replaced after this server was connected.
- [`NotSupportedException`](https://learn.microsoft.com/dotnet/api/system.notsupportedexception): The selected namespace contains more than one session.
- [`LibTmuxException`](/en/csharp/latest/reference/libtmux-libtmuxexception/): The verified client could not complete the query.
