Host not resolved on LAN

I get the IOExeption "Host not resolved" on HttpPost. The end point in this case is a computer on my local network with a web service. ( http: // pc259: 8080 / test / service.asmx ). I use WIFI on my local network. Does Android know for allowed computing?

StringEntity se = new StringEntity(xmlDataToSend);
se.setContentType("text/xml");
HttpPost httppost = new HttpPost(endPoint);     
httppost.setHeader("Content-Type","application/soap+xml");
httppost.setEntity(se);         
HttpClient httpclient = new DefaultHttpClient();
Log.i(TAG, " - Before execute");
httpResponse = (BasicHttpResponse) httpclient.execute(httppost);
0
source share
2 answers

You can force Java to resolve NetBIOS names using the JCIFS library. You can get it from http://jcifs.samba.org/ . Add this to your project, and then use this code to translate the host name into an IP address.

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

, pc259 DNS-, NetBios (. http://en.wikipedia.org/wiki/NetBIOS#NetBIOS_name_vs_host_name).
, Android - DNS.

+1

Source: https://habr.com/ru/post/1665929/


All Articles