/**
* Infer if Ping URLs are returned successfully
*
* @param netaddress
* @return
*/
public static string ispingsuccess (int pingnum, string m_strfornetaddress) {
StringBuffer tv_pinginfo = new StringBuffer ();
try {
Process p = runtime.getruntime (). EXEC ("/system/bin/ping-c" + Pingnum + "" + m_strfornetaddress); 10.83.50.111
M_strfornetaddress
int status = P.waitfor ();
String result = "";
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 ();
Read all the information and show
while ((str = buf.readline ()) = null) {
str = str + "\ r \ n";
Tv_pinginfo.append (str);
}
return tv_pinginfo.tostring ();
} catch (Exception ex) {
Ex.printstacktrace ();
}
Return "";
}
Implementation of the ping command in Android