<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "Event",
  "identifier" : "/documentation/Event/ServerSocket/localPort",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Event"
    ],
    "preciseIdentifier" : "s:5Event12ServerSocketC9localPorts6UInt16Vvp"
  },
  "title" : "localPort"
}
-->

# localPort

The local TCP port this listener is bound to (host byte order).

```
var localPort: UInt16 { get }
```

## Discussion

Convenience over [`localAddress`](/documentation/Event/ServerSocket/localAddress). Returns `0` if the address is not
available (e.g. the socket is closed) or the address family is not
`AF_INET` / `AF_INET6`.