Wifi 如何在通过电缆连接时获取IP地址

Wifi 如何在通过电缆连接时获取IP地址,wifi,ip-address,Wifi,Ip Address,这是一张桌子,我的公司组装它,没有wifi,没有sim卡,只有电缆; 现在,我如何获得Ipaddress和其他配置 我不能使用WifiManager/WifiInfo…,因为是通过电缆连接的;我们不能使用WifiManger;我发现LinuxShell可以帮上忙 但我知道的不多 private String do_exec(String cmd) { String s = "\n"; try { String[] cmdline = {"s

这是一张桌子,我的公司组装它,没有wifi,没有sim卡,只有电缆; 现在,我如何获得Ipaddress和其他配置


我不能使用WifiManager/WifiInfo…

,因为是通过电缆连接的;我们不能使用WifiManger;我发现LinuxShell可以帮上忙

但我知道的不多

private String do_exec(String cmd) {
        String s = "\n";
        try {
            String[] cmdline = {"sh", "-c", cmd};
            Process p = Runtime.getRuntime().exec(cmdline);
            BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
            String line = null;
            while ((line = in.readLine()) != null) {
                s += line + "\n";
            }
            in.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        Log.e("do_exec", s);
        return s;
    }