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

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐