마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

Ping으로 서버 속도 알아내는법 질문

0 추천

안녕하세요 안드로이드펍 가족님들..

현재 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
 
흠바바 1 (4,000 포인트) 님이 2013년 9월 25일 질문

답변 달기

· 글에 소스 코드 보기 좋게 넣는 법
· 질문에 대해 추가적인 질문이나 의견이 있으면 답변이 아니라 댓글로 달아주시기 바랍니다.
표시할 이름 (옵션):
개인정보: 당신의 이메일은 이 알림을 보내는데만 사용됩니다.
스팸 차단 검사:
스팸 검사를 다시 받지 않으려면 로그인하거나 혹은 가입 하세요.
...