Connect to localhost from android device

前端 未结 3 1966
栀梦
栀梦 2021-01-16 03:14

i have already search this topic and still don\'t know how to make it work :(
I have a SOAP web service (ASP.NET), and this address (on my localhost) is http://localhos

相关标签:
3条回答
  • 2021-01-16 03:35

    Use Http Connection

    HttpClient httpclient = new DefaultHttpClient();            
    HttpGet httppost = new HttpGet("http://localhost/");
    HttpResponse response = httpclient.execute(httppost);              
    HttpEntity ent=response.getEntity();
    InputStream is=ent.getContent();
    
    0 讨论(0)
  • 2021-01-16 03:44

    You need to set uses-permission - android.permission.INTERNET in AndroidManifest.xml and also test that (http://192.168.43.17:50473/Service1.asmx) url on web-browser.

    0 讨论(0)
  • 2021-01-16 03:50

    You may have your web server listening on your loopback interface and not on your network interface. Major signs of this are:

    • Hits on 127.0.0.1 and localhost (from localhost or Android emulator) work
    • Hits on 192.168.xxx.xxx do not work, whether from localhost, LAN, or WAN

    I talk more about diagnosing this and fixing this in an answer here.

    0 讨论(0)
提交回复
热议问题