Reputation: 299
I am working on a Wear OS app where I am trying to reach a list of IP addresses via a socket connection. Those IP addresses are nonsense (e.g. 1.1.1.1) but the socket still connects. You can reproduce it by deactivating Wifi and mobile data and connecting to your phone via Bluetooth.
Edit: I found out that it's because of the connection being proxied by Google when using Bluetooth --> firebaselogging.googleapis.com/1.1.1.1
. And this URL is reachable by the socket of course. Do you have an idea how I can still test a connection using sockets?
val connectionTestState = try {
socket.connect(InetSocketAddress(connection.ip, connection.port), 1000)
Log.d("CONNECTION_TEST", "connection available for ${connection.ip}")
ConnectionTestState.Reachable
} catch (e: Exception) {
Log.d("CONNECTION_TEST", "connection error for ${connection.ip} ${e.message}")
ConnectionTestState.NotReachable
} finally {
socket.close()
}
I am using a Pixel Watch 2.
Upvotes: 0
Views: 64