안녕하세요 안드로이드펍 가족님들..
현재 ping을 이용해서 id의 속도 가져오는것을 구현하려고하는데요
아래와 같이 코딩을 하니까 로그가 찍히는데요.
어떤데 속도값인가요.
가장아래쪽에 있는 39.779 ms 이걸 가지고하면 되나요.
try {
String pingCmd = "ping -c 5 144.76.156.238";
String pingResult = "";
Runtime r = Runtime.getRuntime();
Process p = r.exec(pingCmd);
BufferedReader in = new BufferedReader(new
InputStreamReader(p.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) {
System.out.println(inputLine);
//Log.e("kim", inputLine +"\n\n");
//text.setText(inputLine + "\n\n");
pingResult += inputLine;
Log.e("kim", pingResult);
//text.setText(pingResult);
}
in.close();
}//try
catch (IOException e) {
System.out.println(e);
}
09-25 09:10:00.840: E/kim(6994): PING 144.76.156.238 (144.76.156.238) 56(84) bytes of data.
09-25 09:10:00.840: E/kim(6994): PING 144.76.156.238 (144.76.156.238) 56(84) bytes of data.64 bytes from 144.76.156.238: icmp_seq=1 ttl=35 time=487 ms
09-25 09:10:01.770: E/kim(6994): PING 144.76.156.238 (144.76.156.238) 56(84) bytes of data.64 bytes from 144.76.156.238: icmp_seq=1 ttl=35 time=487 ms64 bytes from 144.76.156.238: icmp_seq=2 ttl=35 time=416 ms
09-25 09:10:02.785: E/kim(6994): PING 144.76.156.238 (144.76.156.238) 56(84) bytes of data.64 bytes from 144.76.156.238: icmp_seq=1 ttl=35 time=487 ms64 bytes from 144.76.156.238: icmp_seq=2 ttl=35 time=416 ms64 bytes from 144.76.156.238: icmp_seq=3 ttl=35 time=428 ms
09-25 09:10:03.810: E/kim(6994): PING 144.76.156.238 (144.76.156.238) 56(84) bytes of data.64 bytes from 144.76.156.238: icmp_seq=1 ttl=35 time=487 ms64 bytes from 144.76.156.238: icmp_seq=2 ttl=35 time=416 ms64 bytes from 144.76.156.238: icmp_seq=3 ttl=35 time=428 ms64 bytes from 144.76.156.238: icmp_seq=4 ttl=35 time=451 ms
09-25 09:10:04.730: E/kim(6994): PING 144.76.156.238 (144.76.156.238) 56(84) bytes of data.64 bytes from 144.76.156.238: icmp_seq=1 ttl=35 time=487 ms64 bytes from 144.76.156.238: icmp_seq=2 ttl=35 time=416 ms64 bytes from 144.76.156.238: icmp_seq=3 ttl=35 time=428 ms64 bytes from 144.76.156.238: icmp_seq=4 ttl=35 time=451 ms64 bytes from 144.76.156.238: icmp_seq=5 ttl=35 time=367 ms
09-25 09:10:04.730: E/kim(6994): PING 144.76.156.238 (144.76.156.238) 56(84) bytes of data.64 bytes from 144.76.156.238: icmp_seq=1 ttl=35 time=487 ms64 bytes from 144.76.156.238: icmp_seq=2 ttl=35 time=416 ms64 bytes from 144.76.156.238: icmp_seq=3 ttl=35 time=428 ms64 bytes from 144.76.156.238: icmp_seq=4 ttl=35 time=451 ms64 bytes from 144.76.156.238: icmp_seq=5 ttl=35 time=367 ms
09-25 09:10:04.730: E/kim(6994): PING 144.76.156.238 (144.76.156.238) 56(84) bytes of data.64 bytes from 144.76.156.238: icmp_seq=1 ttl=35 time=487 ms64 bytes from 144.76.156.238: icmp_seq=2 ttl=35 time=416 ms64 bytes from 144.76.156.238: icmp_seq=3 ttl=35 time=428 ms64 bytes from 144.76.156.238: icmp_seq=4 ttl=35 time=451 ms64 bytes from 144.76.156.238: icmp_seq=5 ttl=35 time=367 ms--- 144.76.156.238 ping statistics ---
09-25 09:10:04.730: E/kim(6994): PING 144.76.156.238 (144.76.156.238) 56(84) bytes of data.64 bytes from 144.76.156.238: icmp_seq=1 ttl=35 time=487 ms64 bytes from 144.76.156.238: icmp_seq=2 ttl=35 time=416 ms64 bytes from 144.76.156.238: icmp_seq=3 ttl=35 time=428 ms64 bytes from 144.76.156.238: icmp_seq=4 ttl=35 time=451 ms64 bytes from 144.76.156.238: icmp_seq=5 ttl=35 time=367 ms--- 144.76.156.238 ping statistics ---5 packets transmitted, 5 received, 0% packet loss, time 4010ms
09-25 09:10:04.730: E/kim(6994): PING 144.76.156.238 (144.76.156.238) 56(84) bytes of data.64 bytes from 144.76.156.238: icmp_seq=1 ttl=35 time=487 ms64 bytes from 144.76.156.238: icmp_seq=2 ttl=35 time=416 ms64 bytes from 144.76.156.238: icmp_seq=3 ttl=35 time=428 ms64 bytes from 144.76.156.238: icmp_seq=4 ttl=35 time=451 ms64 bytes from 144.76.156.238: icmp_seq=5 ttl=35 time=367 ms--- 144.76.156.238 ping statistics ---5 packets transmitted, 5 received, 0% packet loss, time 4010msrtt min/avg/max/mdev = 367.254/430.417/487.597/39.779 ms