开发者

Why am I Not able to send http request over WIFI to a machine on the local network from my android device

I am on WIFI and my Android device开发者_如何学JAVA is connected.

In the android device I open a browser and go to http://192.168.1.12 - This is the IP address of the machine/server on the local network. I get the home page from this machine into my browser on the android device (because there is web server installed and it is a server machine).

Through my Java program - HttpPost is working very well for external sites like http://www.yahoo.com through WIFI - but it is NOT working for a server on the LAN

HttpClient hc = new DefaultHttpClient();
HttpPost post = new HttpPost("http://192.168.0.12/");
HttpResponse rp = hc.execute(post); 

The above code DOES NOT work and http response status 404. But if I change the above url to say "http://www.yahoo.com" it works and response status is 200

Can anyone help please


The machine's IP is 192.168.1.12, but you're using HttpPost with 192.168.0.12.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜