9

I run a web project targeted to be deployed on the Google Appengine locally from within Eclipse. So the server starts up and it can be accessed normally by typing localhost:8080 into some browser. Everything fine so far. But what I need is to access it from outside, say from a friend's machine (which obviously resides in the same wireless network). So when he types the following <my-notebook-ip-address>:8080 he should reach the locally running webserver (within Eclipse). But that doesn't work!

The reason I need this is that I want my Android app running on my notebook within the Android emulator to access my locally running webserver. This is just possible by using the notebooks real ip address since localhost on the Android will be the phone itself.

Some more details

  • Mac OSX Snow Leopard
  • Eclipse Galileo
  • Webserver: Google Appengine (launched within Eclipse)

When launching the Appengine server from within Eclipse I can access it with: http://localhost:8080.
I cannot access it however from my local notebook (where the webserver is running within Eclipse) with: http://192.168.0.5:8080 where the IP is my IP address in the network.

I have all Firewalls disabled!

4 Answers 4

30

Not sure if this applies to your situation, but you can access the host PC from your Android device with 10.0.2.2 instead of localhost.

Ref.

official documentation

2
  • hey, that's cool. I was about to accept Rob's answer since that works of course, but then I tried your solution. No clue why this works, do you have any explanation for that?? Anyway it's much more comfortable, since I often switch between different IP addresses and so I always have to reconfigure it. Many thx.
    – Juri
    Oct 27, 2009 at 20:32
  • 1
    That's just the way it was designed by the Android engineers. The loopback interface is that for the actual Android device, and 10.0.2.2 is that of the host PC.
    – JRL
    Oct 27, 2009 at 20:42
5

More specifically, in the Eclipse->Run Configurations, select your run configuration, go to the "(x)= Arguments" tab and add the text --address=192.168.0.5

1
  • Or, if your DHCP address changes sometimes: --address=0.0.0.0
    – rakensi
    Jan 10, 2013 at 19:04
2

By default, appengine listens only on localhost.

Try starting GAE with the address parameter, e.g. "dev_appengine.py --address=192.168.0.5"

0

I only wanted to point out, in case it wasn't clear enough, that the 10.0.2.2 solution proposed by JRL works great but only for emulated Android devices. Real devices have to stick to Rob's approach.

Further details in: http://developer.android.com/tools/devices/emulator.html#networkaddresses

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.