InetAddress address = InetAddress.getByAddress( new byte[] { (byte) 192, (byte) 168, (byte) 254, (byte) 10 ); success = address.isReachable( 3000 );
This returns false even though I am reasonably sure it is a reachable address.
I found that if I changed this to 127, 0, 0, 1 it returned success.
My next attempt was same code, but I used the address I got from a ping of http://www.google.com ( 72.167.164.64 as of this writing ). No success.
You can create a servlet/webpages or whatever you feel comfortable on the server that return ok or error depending on server status from your android you must call that url and check returned value, also on your try/catch you must watch specific exception for example related with timeout, also check for http status if your http request returned 200 then was ok and you can fetch server status from that url
Check http://developer.android.com/reference/java/net/HttpURLConnection.html
the readStream is a method that convert inputstream to string
this is just and idea…. there are a lot of ways to check server availability