# io.github.libtmux.transport.ControlCarrier.pinSocket

- **Module:** io.github.libtmux.transport
- **Package:** io.github.libtmux:libtmux
- **Language:** Java
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-java/blob/4d77001ac74cd9b7f66d1a56319a97ff6e0b2cd5/libtmux/src/main/java/io/github/libtmux/transport/ControlCarrier.java#L39
- **Page:** https://libtmux.org/en/java/latest/reference/io-github-libtmux-transport-controlcarrier-controlcarrier-pinsocket/

```
default PinnedSocket pinSocket(
        String socketPath,
        Duration timeout)
        throws IOException
```

Retains this realm's Unix socket against replacement before control initialization.

The alias must refer to the same socket inode for its lifetime, within a private directory
on the same filesystem. Replacing the original pathname must never redirect the alias.
The caller owns the returned pin; the carrier remains borrowed.

## Parameters

- `socketPath` (`String`): the daemon's own socket path in this carrier's realm
- `timeout` (`Duration`): the remaining acquisition budget

## Returns

the retained endpoint

## Errors

- [`IOException`](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/io/IOException.html): if pinning fails
- [`UnsupportedOperationException`](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/UnsupportedOperationException.html): when this carrier cannot retain an endpoint
