简体   繁体   English

如何在Android手机上运行arp命令

[英]How to run arp command on an android phone

I have connected three cameras to my phone and i want to know their ip addresses. 我已经将三个摄像头连接到手机,我想知道它们的IP地址。 In windows and linux its with the arp command but this command does not run on the android terminal . 在Windows和Linux中,它使用arp命令,但此命令无法在android终端上运行。 How can i run arp command on android or it there any other way to achieve the same? 我如何在android上运行arp命令或有其他方法可以实现相同的目的?

use this code work for me. 使用此代码为我工作。

try {
        Process process = Runtime.getRuntime().exec("cat /proc/net/arp");

        BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
        String line;
        String output = "";
        while ((line = reader.readLine()) != null) {
            System.out.println(line);
        }
        reader.close();
        Log.d("*************", ""+output);
    }
    catch (IOException e) {
        e.printStackTrace();
        System.out.println(e);
    }
    return "";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM