android arp 命令,Process command “arp -a” on android?
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 inst
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();
}
更多推荐
所有评论(0)