如何检查IP地址是否可到达

Aru*_*mar 2 android

在我的应用程序中,我使用下面的代码检查了是否存在ineternet连接

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

现在的问题是,我如何检查是否存在对一台远程计算机Ip的依赖...我需要连接到外部IP网络服务.....需要检查连接到那个.假设链接就像是如下

http://192.168.1.158/VisionEPODWebservice/Manifest.asmx

Kri*_*dra 13

InetAddress.getByName(ip).isReachable(timeout);
Run Code Online (Sandbox Code Playgroud)

请参阅InetAddress的文档