简体   繁体   中英

Difficulty accessing local webserver

I have an Echoprint local webserver (uses tokyotyrant, python, solr) set up on a Linux virtual machine.

I can access it through the browser or curl in the virtual machine using http//localhost:8080 and in the non-virtual machine (couldn't find out how to say it better) I use the IP on the virtual machine also with the 8080 port.

However, when I try to access it through my android on the same wifi I get a connection refused error.

If you are referring your localhost on your system from the Android emulator then you have to use 10.0.2.2:8080. Because Android emulator runs inside a Virtual Machine(QEMU) therefore here 127.0.0.1 or localhost will be emulator's own loopback address.

Refer: Emulator Networking

Is the server bound to localhost or 0.0.0.0?

Maybe your host resolves that ip to some kind of a localhost as well, due to bridging.

Both "localhost" and "127.0.0.1" are local loopback interfaces only: they only make sense within the same machine. From your Android device, assuming it's on the same wifi network as your machine, you'll need to use the actual IP address of your main machine: you can either find that from the network settings of that machine, or from your router's web interface.

In case someone has the same problem, I solved it. The connection has to be by cable and on the VMware Player settings the network connection has to be bridged, also you must click "Configure adapters" and uncheck the "VirtualBox Host-Only Ethernet Adapter".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM