So I have an android application that needs to connect to a socket server. That's simple enough if the socket server was running on my development machine. However the socket server is running on a server not only not on my own machine, but on a different subnet. How would I connect my emulator to the socket server? I understand how the port forwarding works to connect to the local machine, but I'm sort of confused on how I can redirect it across a subnet from my dev machine.
+1
A:
Can you get to the socket server from the host machine of the emulator? I don't know about you, but I've been testing a networked client app on the Android emulator, and it seems to be able to access anything on the network that my development box can with just the standard Java networking calls and no special setup emulator-side. This includes the wider Internet.
If you can't, you need to set up the server side to make sure the server is exposed to remote machines; this has nothing to do with what you're doing on the Android emulator side unless the server is also an Android emulator. It may have to do with firewall rules and standard network routing of course.
Walter Mundt
2010-08-12 17:56:18
My dev machine can connect to the socket server no problem. I'll keep messing with it
Falmarri
2010-08-12 19:29:19
What does your network look like, outside the emulator? Perhaps there's some kind of conflict with the emulator's address space.
Walter Mundt
2010-08-12 19:34:10
Also, as a troubleshooting measure, you could create an ssh tunnel on the dev machine with `ssh server -L1234:localhost:serverport` and then have your app connect to `10.0.2.2:1234` for some port 1234 to see if your net code is working at all.
Walter Mundt
2010-08-12 19:36:11
Oh you know what? The emulator could be conflicting with the address space. I don't know the entire layout of the network. I'll ask the admin what the subnets look like
Falmarri
2010-08-13 17:33:42
The emulator uses 10.0.2.*, but unless your local subnet or the socket server are on one of those addresses I think you should be okay.
Walter Mundt
2010-08-13 18:15:56