我正在尝试获取Connected Device details of Network
。我已经参考了网络发现存储库,我能够获得IP地址和Mac地址(硬件地址),但无法Host name
&device type
.
我已经使用不同的Stackoverflow的建议帖子下面的代码。我还实现了jcifs jar
。但不幸的是,我无法从网络中获取主机名和它的类型。
代码:
1)
NbtAddress nbtAddress = NbtAddress.getByName("Base");
InetAddress address = nbtAddress.getInetAddress();
String hostname = address.getHostAddress();
2)
InetAddress addr = NbtAddress.getByName(strIp).getInetAddress();
host.hostname =addr.getCanonicalHostName();
你的建议值得考虑吗? 如果您使用的是1.3.17 JCIFS,它有一些错误,导致它不返回主机名。您可以尝试使用旧版本的JCIFS,它将为您提供主机名。旧版本的JCIFS(1.2.25)有其他问题,但这取决于您使用它的目的。