Ip address to NetBIOS/FQDN name in Java/Android

后端 未结 3 1898
梦毁少年i
梦毁少年i 2021-02-06 18:58

given the ip address of a computer on the same network of my Android device, i have to find its NetBIOS/FQDN name ... is there any \"clean\" solution to accomplish this with the

3条回答
  •  终归单人心
    2021-02-06 19:24

    Actually, the code provided by Tom does not work, this code works for me (with JCIFS lib.)

    NbtAddress[] nbts = NbtAddress.getAllByAddress("IP ADDRESS AS STRING");
    String netbiosname = nbts[0].getHostName();
    

    returns NetBios device name as string if successful or throws UnknownHostException if target does not exist or has no NetBios name.

提交回复
热议问题