android怎么实现ping
答案:1 悬赏:0 手机版
解决时间 2021-01-25 12:01
- 提问者网友:聂風
- 2021-01-24 23:14
android怎么实现ping
最佳答案
- 五星知识达人网友:舊物识亽
- 2021-01-25 00:39
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();
//读出所有信息并显示
while((str=buf.readLine())!=null){
str = str + "\r\n";
tv_PingInfo.append(str);
}
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();
//读出所有信息并显示
while((str=buf.readLine())!=null){
str = str + "\r\n";
tv_PingInfo.append(str);
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯