Instance Property
localAddress
The local endpoint this listener is bound to, as reported by getsockname(2).
var localAddress: SocketAddress? { get }
Discussion
Useful for port: 0 binds where the kernel assigns an ephemeral port — read this back to learn which port clients should connect to. Returns nil if the descriptor is closed or the syscall fails for any reason.