ICMP and Java have had a long and sordid history, IIRC. You might consider doing your own ping via the NDK.
Personally, I would have the server monitor running on a server, and have the Android app only be a control panel/notification mechanism, but that's just me. On Mon, Dec 27, 2010 at 2:02 PM, bc <[email protected]> wrote: > Thank you for the replies. > > Perhaps I should give a little background on this phenomena. A few > years ago I created a free server monitor. The monitor has always had > ping checks, port checks, and http(s) checks. I was doing ping checks > via the isReachable method. I have never had issues with the > isReachable method until recently. By recently I mean late last > summer, I began getting more and more complaints from users that ping > is not working. I usually gave the canned response to ping not working > because the ping portion of the application had been stable and > working for about a year and a half. > > Now, as it turns out, I cannot get it to work. > > I am thinking I need to remove the "Ping" feature from my application. > However, the backlash from users when a feature is removed is usually > quick and severe. Even though the application is free I really want > this to be a last resort. Is there an alternative to isReachable? > > > > > > On Dec 27, 11:54 am, Mark Murphy <[email protected]> wrote: >> On Mon, Dec 27, 2010 at 12:46 PM, bc <[email protected]> wrote: >> > I am stumped. InetAdress.isReachable simply does not work. By that I >> > mean, it always returns false for an external host. >> >> > I have tried searching the internet to see if anybody else is having >> > the same problem, I have found a few people have had the same problem, >> > but cannot really find an explanation why. >> >> > I have tried this on multiple devices with the same result. >> >> > boolean blnResult = >> > InetAddress.getByName("localhost").isReachable(20000); >> >> > The above line of code works every time. If I change the "localhost" >> > to an external host that I can verify "isReachable", the result is >> > always false. >> >> > blnResult = >> > InetAddress.getByName("www.google.com").isReachable(20000); >> > blnResult = InetAddress.getByName("4.2.2.2").isReachable(20000); >> >> > The above lines always return false, even though I can use a terminal >> > emulator on the same device and get a true result. >> >> > Can somebody more experienced with Android or perhaps a Google >> > engineer please give a plausible explanation for this. >> >> http://stackoverflow.com/questions/2935325/android-debugging-inetaddr... >> >> isReachable() attempts to connect to port 7, which may be eaten by >> firewalls. This is a legacy holdover from Java -- I would recommend >> trying to do something more meaningful, like an HTTP GET request on a >> known good URL if you are trying to see if a Web service is reachable. >> >> -- >> Mark Murphy (a Commons >> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy >> >> Warescription: Three Android Books, Plus Updates, One Low Price! > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Warescription: Three Android Books, Plus Updates, One Low Price! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

