Host is unresolved in LAN

前端 未结 2 1043
[愿得一人]
[愿得一人] 2021-01-26 12:46

Im getting a IOExeption \'Host is unresolved\' on HttpPost. The Endpoint in this case a a computer on my LAN with a webservice. (http://pc259:8080/test/service.asmx). Im using W

2条回答
  •  情深已故
    2021-01-26 13:14

    You can get Java to resolve NetBIOS names by using the JCIFS library. You can get it from http://jcifs.samba.org/. Add that to your project and then use code like this to convert a host name to an IP address.

    import jcifs.netbios.NbtAddress;
    ...
    NbtAddress nbtAddress = NbtAddress.getByName(hostname);
    InetAddress address = nbtAddress.getInetAddress();
    String ipAddress = address.getHostAddress();
    

提交回复
热议问题