Android Emulator (qemu) does not allow certain tcp connections (RST,ACK as answer to SYN)
Although Internet browsing works in the emulator, my app who also runs in the emulator, is unable to connect to a server on the internet on port 5222 via TCP. I'm pretty sure that there is no firewall involved on my router or on my pc, as I can telnet to that ip:port from my pc.
Here is a screenshot of the packettrace taken on the emulator: http://i.stack.imgur.com/sIFFM.png
A packet开发者_Go百科-trace on the emulated device showed that every SYN packet to that particular port is answered with RST,ACK and the connection is closed by my app with a "connection error".
Why does the emulator block (?) these ports? How can I change it?
The Emulator runs on it's own network, so if you want to communicate through different ports you have to setup forwarding correctly for non-standard ports.
If you want to have external applications connecting to your application running in the emulator you will need to setup your forwarding so that the external application will connect to the port on your development machine and emulator will forward it connection to the 10.0.2.15 which is the emulators address.
See the dev guide for more info:
http://developer.android.com/guide/developing/tools/emulator.html#connecting
Got it. As http://developer.android.com/guide/developing/tools/emulator.html#proxy states, the proxy set in the environment variable http_proxy will be used for all TCP connections. But my proxy is configured to allow only certain TCP ports.
unset $http_proxy
or use
emulator -http-proxy none
("none" is not a correct proxy, so it will give you an error message. But at least the environment variable is not processed)
PS:
If the -http-proxy command is not supplied, the emulator looks up the http_proxy environment variable and automatically uses any value matching the format described above.
Google, thats crazy. I've set the http_proxy environment variable because I wan't the http(s) traffic to go through that proxy. Not all TCP Connections.
精彩评论