boolean success=false; Process p =null; try { String ip= "192.168.1.111"; p = Runtime.getRuntime().exec("ping -c 1 -i 0.2 -W 1 " +ip); int status = p.waitFor(); if (status == 0) { success=true; } else { success=false; } } catch (IOException e) { success=false; } catch (InterruptedException e) { success=false; }finally{ p.destroy(); }
Android Ping
最新推荐文章于 2021-05-27 08:48:15 发布