Want to do a test network connection android apk stability, I now practice is to call the ping command, but I feel like there is no way to get to the ping command returns information such as delays, as well as the site ip address, only to get successful.
The question now is, I hope to get to the delay and the site ip address and other information. Personal guess not necessarily need to use the ping command, if there are other ways to solve it. Wait for a reply.
By the way, I am doing now attach code
Process p = Runtime.getRuntime (). Exec ("ping-c 1" + m_strForNetAddress) ;/ / m_strForNetAddress a URL or enter Ip address
int status = p.waitFor (); / / status can only get if successful, can not get more information
if (status == 0) {
result = "success";
}
else
{
result = "failed";
}
Reply:
Nobody can give a solution to it
Reply:
Same problem, look forward to. . .
Reply:
Themselves
.
Process p = Runtime.getRuntime () exec ("/ system / bin / ping-c" + pingNum + "" + m_strForNetAddress); / / 10.83.50.111 m_strForNetAddress
int status = p.waitFor ();
if (status == 0) {
result = "success";
}
else
{
result = "failed";
}
String lost = new String ();
String delay = new String ();
BufferedReader buf = new BufferedReader (new InputStreamReader (p.getInputStream ()));
String str = new String ();
All information / / read and display
while ((str = buf.readLine ())! = null) {
str = str + "\ r \ n";
tv_PingInfo.append (str);
}
Reply:
Why I did not respond to ping how ah
Reply:
Thanks to the landlord to provide solutions, thank you very much!
Reply:
Seemed int status = p.waitFor (); This line is often blocked, do not know why, how to break ...
Reply:
What pingNum is ah
Reply:
Parameter values of the parameter-c, ping times (count), I'm white
Reply:
Thank landlord! ! !
No comments:
Post a Comment