我下用以下程序:
  public static String pingServer() {
PingResult result = new PingResult();
String jsonString = null;
try {
String command = "ping -c 3 192.168.8.185";
Process p = Runtime.getRuntime().exec(command);
int status = p.waitFor();
InputStream input = p.getInputStream();
BufferedReader in = new BufferedReader(new InputStreamReader(input));
StringBuffer buffer = new StringBuffer();
String line = "";
while ((line = in.readLine()) != null) {
buffer.append(line);
buffer.append("\n");
}
String bufferStr = buffer.toString();
        System.out.println(bufferStr); } catch (Exception e) {
System.out.println("---------------exception-----------ping");
System.out.println(e.getMessage());
// e.printStackTrace(); }
             }
bufferStr获取的总是最后一行数据:
 3 packets transmitted, 3 received, 0% packet loss, time 2000ms
而详细结果:
老是得不到!!!

android调用ping命令返回信息