networking - Android InetAddress.getByName(ip).isReachable(timeout) always returns false -


i see 24 similar questions asking inetaddress.isreachable() instance never returns true, when network otherwise reachable, 1 exception of tests against 127.0.0.1.

if (inetaddress.getbyname("google.com").isreachable(2000)) {     system.out.println("visible"); } else {     system.out.println("not visible"); } 

and permissions

<uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state"/> 

this code started within thread (of course). app needs know if specific ip accessible (not google, in above example). behaves same in emulator.

is there better way test network connectivity?


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -