I'm trying to access a web server running on the Android emulator from my machine. I know the reverse i.e., how to access the server running on my local machine from the Android emulator (using I have searched a lot about this stuff but couldn't get any relevant information.

When the server is up and running inside the emulator I can access it using I can do a telnet to the emulator, but I wonder how that will be helpful. Any suggestions on how to get connected to the web server running inside the emulator?

1 Answer 1


You need to create a port forwarding to your Android device. This can be done with ADB.

adb forward <local> <remote> - forward socket connections
                                 forward specs are one of: 
                                   localabstract:<unix domain socket name>
                                   localreserved:<unix domain socket name>
                                   localfilesystem:<unix domain socket name>
                                   dev:<character device name>
                                   jdwp:<process pid> (remote only)

For example: run adb forward tcp:12345 tcp:23456 and then use the URI http://localhost:12345 to access the server running on port 23456 in the emulator. Note that some ports are reserved for Android and some can only be used after rooting, so I'd suggest using high ports (>20000) if you can.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .