<!--
{
  "availability" : [

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

# port

The TCP port number.

```
let port: Int
```

## Discussion

Typed as `Int` for ergonomics; valid values are **1–65535**
([RFC 6335 §6](https://datatracker.ietf.org/doc/html/rfc6335#section-6)),
but the initializer does not enforce the range. A value outside
that range is accepted at construction and rejected by `connect(2)`
when the endpoint is actually dialled, surfacing as
[`TorError.ioError(_:)`](/documentation/Tor/TorError/ioError(_:)).

- Stability: immutable (`let`).
- Typical values: `9050` (Tor SOCKS5 default), `9051` (Tor control
  port default), `80` / `443` for onion-service forwarding targets.