I'm trying to understand how to get the name of a computer on my LAN given the IP address with JCIFS but I can't get anything but its IP.
The code I'm using is
InetAddress addr = NbtAddress.getByName( ip ).getInetAddress();
String test = UniAddress.getByName(ip).getHostName();
System.out.println("IP: " + ip + " - addr: " + addr.getHostName() + " - test: " + test);
And the result I'm getting is
IP: 10.1.2.115 - addr: 10.1.2.115 - test: 10.1.2.115
If instead I replace the getHostAddress() with toString() what I get is
IP: 10.1.2.115 - addr: 10.1.2.115 - test: 0.0.0.0<00>/10.1.2.115
Where am I wrong here?
I'm testing the lib from a Mac with IP 10.1.2.117, while the target is an Android device.
JCIFS stop supports Netbios name resolution on 1.3.14 version. You can find release notes for stopping this. https://jcifs.samba.org/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With