1

Based on this and this topic, which describe how to connect to your local development manchine from an android emulator, I have an additional question.

Basically I have on my windows machine multiple sites in my hostfile like so:

127.0.0.1 site1
127.0.0.1 site2
127.0.0.1 site3

Now if I want to connect to site2 from my app. It will not work when i do 10.0.2.2

So how could I fix this?

Thanks.

Community
  • 1
  • 1
sanders
  • 10,794
  • 27
  • 85
  • 127
  • How would that work in a browser on your pc? Please give examples. – greenapps Aug 17 '15 at 17:39
  • @greenapps in my browser on my pc i would call it like http://site1 or http://site2 or http://site3 – sanders Aug 17 '15 at 19:39
  • You could use the same ip for all sites but different ports for each – Tim Aug 17 '15 at 19:40
  • 'i would call it like site1 or site2 or site3'. And that would give you the same site on 127.0.0.1? Because how would you get different responses for those three hostnames? – greenapps Aug 17 '15 at 19:45
  • @sanders, 127.x.x.x is a loopback address. You can't connect to it remotely, such as from another laptop, or the android emulator. Pick another address like 192.168.x.x and you can do something like 192.168.16.1, 192.168.16.2, and 192.168.16.3. Or even use different ports like 192.168.16.1:80, 192.168.16.1:8080, 192.168.16.1:8181. Or you could use: www.domain1.com, www.domain2.com, and www.domain3.com. – Larry B Aug 17 '15 at 19:50

0 Answers0