Hello. I'm programming an application for Android 2.3.3 but I'm having problem with emulator sockets. I need to create a socket connection between Android emulator on one computer and a server on another computer (the computers are in the same network). My application uses two ports to communicate, 5000 and 5001 and the server is listening on the port 12345. When the application starts it tries to connect to the other computer and sends it it's ip addres and port numbers so they can communicate. The server receives these parameters but when it tries to open a socket towards the emulator the socket times out. My application has the INTERNET permission and I have redirected ports 5000 and 5001 to 5557 and 5558. I've been having this problem the whole week and I don't know what to do anymore.

P.S. When I used this code to connect two computers together instead of an emulator and a computer it worked perfectly. The two computers can communicate without any truble.