Conexión de la máquina local al emulador de Android

Just finding answers to the other way around!

I can get my emulator to connect to my server when hosting on the local machine using IP 10.0.2.2. However it doesnt work the other way when i try to connect from the local machine to my hosting emulator.

I this case i use IP 127.0.0.1, and i get a ConnectException: connection refused. Strangely it works fine when im both hosting and using the client on the emulator.

¿Que pasa con eso?

preguntado el 08 de noviembre de 11 a las 17:11

2 Respuestas

Even I m facing the same problem. I think this is the solution however I m not able to get it to work on Linux. Here is the link ¿Cómo puedo reenviar mi dirección IP de localhost a un emulador de Android?

contestado el 23 de mayo de 17 a las 15:05

Thanks for forwarding this link! - Lucas Arrefelt

// write in manifest file  
<uses-permission android:name="android.permission.INTERNET"></uses-permission>

Start local server and use http://10.0.2.2/

respondido 08 nov., 11:21

I believe you got me wrong. Im hosting on the android emulator, and trying to connect from my java client on the local machine. Im using ServerSocket and Socket, and my manifest already got that permission - Lucas Arrefelt

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.