Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How can I allow a port on an Ubuntu 11.10 machine that is on an Ethernet LAN to be accessed by my Android device via WiFi on the same LAN?

Specifically, I'm doing some Android app development where the app needs to access a port on the Ubuntu machine (http://192.x.x.x:port) and the Android app responds:

Failure: Connection to http://192.x... refused

I am using the LAN address 192.x... as displayed by ifconfig on the Ubuntu machine.

Thanks.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Perhaps there is no service listening on the port you are connecting to?

Just to check if there is a networking problem, you can open a terminal, cd to a non-private directory (be careful, the content of all files of the directory where this command is started will be served on a network, so choose with care) and enter:

python -m SimpleHTTPServer 8000

This will serve the current directory over HTTP on port 8000 on all your network interfaces.

Now on your Android open a browser and enter the address http://192.x.x.x:8000 and check if your browser displays the files from the directory where you entered the python command above.

  • If yes: your network settings are correct and the problem may be within your app or there is no service listening on the needed port on your Ubuntu machine (see my question above).
  • If no (no files are displayed): there may be a firewall active (on your router or on your Ubuntu machine). Some routers don't allow that WiFi stations communicate with each other or with the LAN IPs by default (check the configuration of your router, OpenWRT for example has an option for this)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.