Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BufferedReader br = null;
- ArrayList<ClientScanResultSO> result = null;
- try {
- result = new ArrayList<ClientScanResultSO>();
- br = new BufferedReader(new FileReader("/proc/net/arp"));
- String line;
- while ((line = br.readLine()) != null) {
- String[] splitted = line.split(" +");
- if ((splitted != null) && (splitted.length >= 4)) {
- // Basic sanity check
- String mac = splitted[3];
- System.out.println("mac is***************"+ mac);
- if (mac.matches("..:..:..:..:..:..")) {
- boolean isReachable = InetAddress.getByName(splitted[0]).isReachable(reachableTimeout);
- String name = InetAddress.getByName(splitted[0]).getHostName();
- if (!onlyReachables || isReachable) {
- result.add(new ClientScanResultSO(splitted[0], splitted[3], splitted[5], isReachable, name));
- }
- }
- }
- }
- } catch (Exception e) {
- Log.e(this.getClass().toString(), e.getMessage());
- } finally {
- try {
- br.close();
- } catch (IOException e) {
- Log.e(this.getClass().toString(), e.getMessage());
- }
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement