微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

连接的热点设备列表

如何解决连接的热点设备列表

我想检索连接到我智能手机 WiFi 热点的所有设备的 IP 地址。 在 Android 10 及更低版本中,我能够通过执行以下代码获得此列表:

Runtime runtime = Runtime.getRuntime();
Process proc = runtime.exec("ip neigh show");
proc.waitFor();
int exit = proc.exitValue();
InputStreamReader reader = new InputStreamReader(proc.getInputStream());
BufferedReader buffer = new BufferedReader(reader);
String line;
while ((line = buffer.readLine()) != null) {
     String[] splits = line.split(" ");
     if (splits.length < 4) {
         continue;
     }
     if(!splits[0].contains("192.168.43.")) {
         Log.d("IP",splits[0]);
         continue;
     }
}

但是,IP 命令似乎不再适用于 Android 11 (https://developer.android.com/training/articles/user-data-ids#mac-11-plus)

The ip command does not return information about interfaces.

还有其他方法可以在 Android 11 中获取已连接客户端的 IP 地址吗?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。