Android 如何獲取鏈接wifi熱點的設備數量

String MacAddr = null;
BufferedReader reader = null;
try {
    reader = new BufferedReader(new FileReader("/proc/net/arp"));
    String line = reader.readLine();
    //讀取第一行信息,就是IP address HW type Flags HW address Mask Device
    while ((line = reader.readLine()) != null) {
        String[] tokens = line.split("[ ]+");
        if (tokens.length < 6) {
            continue;
        } String ip = tokens[0]; //ip
        String mac = tokens[3];  //mac 地址
       String flag = tokens[2];//表示鏈接狀態
    }
} catch (FileNotFoundException e) {
} catch (IOException e) { 
} finally {
    try {
        if (reader != null) {
            reader.close();
        }
    }
    catch (IOException e) { }
}                        spa

相關文章
相關標籤/搜索