Arun Kumar
Arun Kumar

Reputation: 877

How to check an IP Address Reachable or not

In my application I have checked whether ineternet connection is there using the below code

   private boolean isNetworkAvailable() {    
             ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); 
             NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();  
             return activeNetworkInfo != null; }

Now the problem is that how can i check whether conncetion to one remote computer Ip is exist or not...I need to connect to an external IP webservice.....Need to check connetion to that .Suppose the link is like as given below

http://192.168.1.158/VisionEPODWebservice/Manifest.asmx

Upvotes: 2

Views: 8311

Answers (1)

Krishnabhadra
Krishnabhadra

Reputation: 34275

InetAddress.getByName(ip).isReachable(timeout);

see documentation of InetAddress

Upvotes: 13

Related Questions