# libtmux.OwnedServer

- **Module:** libtmux
- **Package:** libtmux
- **Language:** Lua
- **Kind:** class
- **Source:** https://github.com/libtmux/libtmux-lua/blob/ec2c4d710bcec2bd54c1ded405e6652e873b0994/lua/libtmux/_internal/server.lua#L1225
- **Page:** https://libtmux.org/en/lua/latest/reference/libtmux-ownedserver/

A tmux server that `libtmux.Runtime:start_server` started and owns.

 `server` is a `libtmux.Server` for it, the same handle `libtmux.Runtime:connect`
 returns, and [`socket_path`](/en/tmux/latest/catalog/formats/socket_path/) is its socket, for a second handle. `stop` ends
 the daemon and removes its directory. The runtime stops every owned server
 that is still running when it ends, whether the body returned, failed or was
 cancelled, so a program that forgets `stop` leaves nothing behind. A stop
 the runtime ran for you that finds a `leaked_server` or `stop_failed` fails
 the run with `cleanup_failed`.

 `libtmux.Server:close` on `server` still only releases the handle.

## Members

### Common operations

- [`server`](/en/lua/latest/reference/libtmux-ownedserver-server/) (attribute): A handle to one running tmux server, reached through a connected runtime.
- [`stop`](/en/lua/latest/reference/libtmux-ownedserver-stop/) (method): Runs `kill-server`, then connects to the socket until nothing listens, for
 at most `timeout` milliseconds, and removes the directory. It resolves to
 `true` once the daemon is gone and the directory removed, and again on later
 calls. A daemon that still answers fails with `stop_failed`, keeps the
 directory and names it in `directory`; calling again tries once more. When
 the program left another tmux server under the directory, `stop` stops it
 too and fails with `leaked_server`, naming each socket in `sockets`.
- [`socket_path`](/en/lua/latest/reference/libtmux-ownedserver-socket_path/) (attribute): The private socket.

## Guides

Pages that discuss `OwnedServer`.

- [Getting started](/en/lua/latest/guides/overview/)
- [Runtime ownership](/en/lua/latest/guides/runtime/)
