how can an android emulator contact the host developing machine in eclipse?

android, eclipse, networking, tcp, virtualbox

Solution

I think you want 10.0.2.2. Check out the Android Emulator Networking documentation: https://developer.android.com/studio/run/emulator-networking.html

Problem

I have a normal simple java program running as a server, waiting for a client to connect with TCP. On another eclipse project, i'm building an android application. That application has to contact the java program running on the host machine to receive a message. I can't simply use "localhost" to contact the server becouse, supposedly, the emulator runs behind a virtual router and i'll be accessing the "phone"'s network instead of the host machine's network. So, what ip should I use to contact the host development machine? The machine is a linux running on a VirtualBox with an Ip of 10.0.0.5. I've tried to use that ip on the emulator but even so, I can't establish a connection.

Original source