resolveLocalAddress

Determines this machine's outward-facing local address.

Works by connecting an unbound DatagramSocket to a public host and reading back the local address the OS routing table selected. Because UDP connect sends no packets, PROBE_HOST is never actually contacted - but the call still requires a routable network interface, so it fails on an isolated machine.

Callers that would rather degrade than fail can recover explicitly:

val address = resolveLocalAddress().getOrDefault(InetAddress.getLoopbackAddress())

Return

the resolved local address, or Result.failure holding the java.net.SocketException or java.net.UnknownHostException that prevented it