Wi-Fi ネットワークに接続されているすべてのワイヤレス デバイスの詳細を取得する必要があります。IP、MACアドレス、どういうわけかデバイスのベンダーも取得しています。
デバイスの種類を取得するにはどうすればよいですか? (つまり、ラップトップ、モバイル、AC、冷蔵庫) ホスト名は?
InetAddress inetAddress = null;
for (int i = 0; i < 256; i++) {
try {
inetAddress = InetAddress.getByName("192.168.1." + i);
if (inetAddress.isReachable(30)) {
ConnectedDevice device = new ConnectedDevice();
device.setDeviceIPAddress(subnet + i);
device.setDeviceMACAddress(Utils.getMacAddressFromArpCache(inetAddress.getHostName()));
Log.d("Device", inetAddress.getHostName() + ", " + inetAddress.getHostAddress() + ", " + inetAddress.getCanonicalHostName() + ", " + device.getDeviceMACAddress());
}
} catch (Exception e) {
e.printStackTrace();
}
}
getHostName()、getHostAddress()、getCanonicalHostName() inetAddress の 3 つのメソッドはすべて、IP アドレスのみを返します。ネットワークに接続されているデバイスのホスト名を取得するにはどうすればよいですか? デバイスのすべての可能な詳細を取得するには、他に何をすればよいですか? 私を案内してください。