As part of learning Node.js, I decided to use it a s a server side for an Android client. I deployed a Ubuntu 11 VirtualBox with Node, NPM, Android SDK and Netbeans 7 - and went to it.
The problem: I cannot access my local host from the emulator.
Here's what I tried:
1. The Node "hello world" script:
var app = require('express').createServer();
app.get('/', function(req, res){
res.send('Hello World\r\n');
});
app.listen(3000);
2. Terminal > ifconfig
returned 'inet addr:10.0.2.15'
3. Terminal > curl 10.0.2.15:3000
-> "Hello World"
4. Browser > http://10.0.2.15:3000 -> "Hello World"
5. Android emulator > app trying to access http://10.0.2.15:3000 -> "Connection to http://10.0.2.15:3000 refused"
6. Android emulator > Android browser > http://10.0.2.15:3000 > "web page not available"
Just to verify, I did Android emulator > Browser > any other page - works.
So it looks like the Android Emulator cannot access the local VirtualBox IP.
I have no firewalls running inside the VBox, and I know of no setting inside the emulator I can change. At first I thoyght it was my app (although it's a dummy "get url" small app with android.permission.INTERNET
in its manifest), but I can't even reach it from the browser.
Any direction or idea I missed?
Your time and assistance is appreciated!
Guy