<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "Tor",
  "identifier" : "/documentation/Tor/TorClient/socksEndpoint",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Tor"
    ],
    "preciseIdentifier" : "s:3Tor0A6ClientC13socksEndpointAA8HostPortVSgvp"
  },
  "title" : "socksEndpoint"
}
-->

# socksEndpoint

Tor’s local SOCKS5 proxy endpoint once start succeeds, else `nil`.

```
var socksEndpoint: HostPort? { get }
```

## Discussion

Populated by `discoverSocksPort()` via the `GETINFO net/listeners/socks` control-protocol key (control-spec.txt
§3.9). Remains `nil` until Tor reaches [`TorState.running`](/documentation/Tor/TorState/running) AND
the port discovery completes; reverts to `nil` on [`stop()`](/documentation/Tor/TorClient/stop()).

- Typical value: `HostPort(host: "127.0.0.1", port: <ephemeral>)`
  when `configuration.socksPort == .ephemeral`, or the literal
  fixed port when `.fixed(n)` was requested.

> Important: Do not hand this endpoint to client code before
> ``doc://Tor/documentation/Tor/TorClient/waitUntilBootstrapped(timeout:)`` succeeds — the SOCKS listener
> is reachable immediately, but traffic will fail with
> `Proxy connection refused` until bootstrap reaches 100%.