From 54a0e140f61070645f50312d4c7adab2caadb143 Mon Sep 17 00:00:00 2001 From: xis Date: Tue, 24 Oct 2023 20:30:31 +0200 Subject: [PATCH] added comment --- .../net/schowek/nextclouddlna/util/ServerInfoProvider.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/kotlin/net/schowek/nextclouddlna/util/ServerInfoProvider.kt b/src/main/kotlin/net/schowek/nextclouddlna/util/ServerInfoProvider.kt index e81f7d5..1473442 100644 --- a/src/main/kotlin/net/schowek/nextclouddlna/util/ServerInfoProvider.kt +++ b/src/main/kotlin/net/schowek/nextclouddlna/util/ServerInfoProvider.kt @@ -47,6 +47,9 @@ class ServerInfoProviderImpl( } } + // perform fake request to 1.1.1.1:80 just to get the localAddress + // with use of the default routing. + // if it fails, we use the localAddress() which can be wrong private fun guessLocalAddress() = try { DatagramSocket().use { s -> s.connect(InetAddress.getByAddress(byteArrayOf(1, 1, 1, 1)), 80)