Apparently isReachable doesn't work reliably on Android (needs root?)
I ended up using the method described here:
http://stackoverflow.com/questions/2935325/android-debugging-inetaddress-isreachable/2935468#2935468

On Jul 4, 10:13 am, -DC- <diskcras...@gmail.com> wrote:
> Here's my code:
>
>             InetAddress address =
> InetAddress.getByName("www.whyoceans.com");
>             if (!address.isReachable(3000)) {
>                 Toast.makeText(this,
>                         "Unable to ping host",
>                         Toast.LENGTH_SHORT).show();
>             }
>
> The isReachable always fails, yet I can open a shell and ping it just
> fine (from both my PC and my phone):
>
> pingwww.whyoceans.com
> PINGwww.whyoceans.com(69.163.249.123) 56(84) bytes of data.
> 64 bytes from apache2-fritz.harmony.dreamhost.com (69.163.249.123):
> icmp_seq=1 ttl=55 time=38.3 ms
> 64 bytes from apache2-fritz.harmony.dreamhost.com (69.163.249.123):
> icmp_seq=2 ttl=55 time=40.9 ms
> ^C
> ---www.whyoceans.comping statistics ---
> 2 packets transmitted, 2 received, 0% packet loss, time 1002ms
> rtt min/avg/max/mdev = 38.319/39.654/40.989/1.335 ms
>
> Why?

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to