www.gusucode.com > Android Ping 分享两种网络检测方法源码程序 > README.txt

    分享给大家一个Android Ping源码。向大家演示了两种常用的android检测网络方法,在工作线程中定时执行检测网络线程,第一种方法是使用Ping,可以这样调用Process p = Runtime.getRuntime().exec("ping -c 1 -w 100 " + ip);// ping1次。用这个方法,除非Ping的网址挂了,否则用这个应该没问题;
Share with you an Android Ping source code. Demonstrated two common Android network detection methods. The network thread detection is performed regularly in the worker thread. The first method is to use Ping. You can call Process p = Runtime.getRuntime (). Exec ("ping -c 1 -w 100 "+ ip); // ping 1 time. With this method, unless the Ping URL is down, you should be fine with this;