标签:style blog io color os java sp div on
public static void get() throws IOException{ String address="10.132.118.110"; Process process = Runtime.getRuntime().exec("ping "+address); InputStreamReader r = new InputStreamReader(process.getInputStream()); LineNumberReader returnData = new LineNumberReader(r); String returnMsg=""; String line = ""; while ((line = returnData.readLine()) != null) { System.out.println(line); returnMsg += line; } if(returnMsg.indexOf("100% loss")!=-1){ System.out.println("与 " +address +" 连接不畅通."); } else{ System.out.println("与 " +address +" 连接畅通."); } }
标签:style blog io color os java sp div on
原文地址:http://www.cnblogs.com/azhqiang/p/4077052.html