Process command “arp -a” on android?

风流意气都作罢 提交于 2019-12-06 14:25:30

问题


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();
    }

回答1:


Install busybox and some terminal emulator, connect to Wi-Fi and you are done.



来源:https://stackoverflow.com/questions/39294726/process-command-arp-a-on-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!