# TmuxServers.discover(in:tmuxExecutable:)

- **Module:** TmuxServers
- **Package:** libtmux-swift
- **Language:** Swift
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-swift/blob/f02a4668570e1cc5198c941413750e021f42c214/Sources/LibTmux/Discovery.swift#L66
- **Page:** https://libtmux.org/reference/swift/tmuxservers-discover(in-tmuxexecutable-)/

```
TmuxServers.discover(in:tmuxExecutable:)(in: [String]?, tmuxExecutable: String) -> ServerDiscovery
```

Every server listening on a socket in `directories`.

A socket file is not a running server: tmux leaves the file behind when
it exits, so each candidate is asked whether it answers. One that does
not answer within two seconds is left out rather than reported as an
empty server. At most eight candidates are asked at once.

- Parameters:
  - directories: where to look. Defaults to
    ``defaultDirectories(environment:)``.
  - tmuxExecutable: the tmux to ask with.
- Returns: At most 128 reachable servers and whether the scan stopped
  before exhausting entries or candidates.
- Throws: ``TmuxError/cancelled`` when the calling task is cancelled.

## Raises

- `TmuxError`
