I'm trying to call "arp -a" on my android device, but since it only works for pc - how do i change this? Is there a way to access a list of the ip-addresses, that arp -a gives you, but on android instead?

My code is like this on the android device:

try {

Process process = Runtime.getRuntime().exec("arp -a");

process.waitFor();

BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));

int i = 0;

while (reader.ready()) {

i++;

String ip = reader.readLine();

if (i >= 4) {

ip = ip.substring(2, 15) + "\n";

}

}

} catch (IOException | InterruptedException ioe) {

ioe.printStackTrace();

}

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐