That would definitely be the best option for server monitor. Not for a network monitor, of course, but you may not face that issue if you're looking at your local LAN.
It's worth noting the Sun Javadoc on the matter: "Test whether that address is reachable. Best effort is made by the implementation to try to reach the host, but firewalls and server configuration may block requests resulting in a unreachable status while some specific ports may be accessible. A typical implementation will use ICMP ECHO REQUESTs if the privilege can be obtained, otherwise it will try to establish a TCP connection on port 7 (Echo) of the destination host." The Android javadoc fits the description of the "typical implementation". It's not just Java weirdness involved here. Back in the early days of IP, ICMP ECHO was almost universally allowed, and port 7 was usually implemented as well. The general attitude was to make the network topology as easy to investigate as possible. In today's environment, the reverse attitude holds, and you also have NAT to contend with! The long and short of it is, this has always been subject to the whims of others, from local firewalls, to mobile carriers, to network engineers responsible for gateways, and finally, for admins responsible for the target servers. Each and any of those can decide at any time to not support ICMP ECHO and/or port 7. Really, in all the years this method has been available, the only use I've found for it in a client environment is advisory. Either you can connect, or you can't. If you can, you have no need for this method. If you can't, and yet this method indicates the server is reachable, then you can inform the user that the server application appears to be down for maintenance. If the method indicates the server is NOT reachable, then you can inform the user that either the server is down, or network connectivity is lost. If you also cannot connect to google.com and a few other goodies, you can suggest that you probably do not have any network connectivity at all. It's more useful in a server environment, where you know and control the specific networking environment. For example, if you lose a connection to your database server, you can see if the server is even up, and report a different failure. You can probe for a failed VPN connection, and disable certain functionality in your application which may depend on it. On Dec 27, 11:12 am, Mark Murphy <[email protected]> wrote: > 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. > -- 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

