I'm just learning Android and am trying to connect to an apache web server running on my local machine to do XMLRPC with the Google XMLRPC library from http://code.google.com/p/android-xmlrpc/. I've added the INTERNET permission to AndroidManifest.xml but whatever I do I keep getting "unknown socket exception -1" in the Log output. I asked on #android on irc.freenode.net and they suggested using adb forward to set up port forwarding, but I'm not sure how to go about this. My emulator runs on tcp port 5554 and I've tried:
adb forward tcp:5554 tcp:80
and the other way around.
I know you can't use localhost because the emulator assumes that you mean its localhost instead of the machine's localhost, so I tried setting up the server on a remote machine - same result. I also thought it might be an issue with virtual hosts, so I ran netcat on the remote server to listen on port 8000:
nc -l 8000
to see if anything was coming from the emulator to that IP. The IP is a VPN IP - not sure if that is a problem. I can telnet from my machine to the remote server with no problems and send traffic to port 8000, but nothing comes from the emulator and I get the same exception.
Here's the details of my setup:
Platform: OS X 10.5 latest version
latest 1.1 SDK running using the ADT plugin on Eclipse 3.4 Ganymede
Apache 2.2.6 running PHP 5 and using the Zend Framework for XMLRPC.
I've tested all the components outside of the emulator (e.g. calling the web service with a command line script) and everything looks fine.
The error I get in the log is "Unknown socket exception -1"
Thanks for any help!