Reputation: 566
I am trying to send data to server using socket programming. The server is in android and the client is in my host machine. The program works fine and the app runs perfectly. But when I try to forward the port from host machine to emulator, it says
KO: bad redirection format, try (tcp|udp):hostport:guestport
The command I used is
redir add tcp:4000:3000
What am I missing here?
Upvotes: 2
Views: 3264
Reputation: 63
I suspect that what you have experienced is a pure typing error.
While typing commands in the Android Emulator Console, it is important to avoid typos, as the backspace does not clear the character as you would expect.
So even if the syntax of your command was correct, you must have made typing errors which you tried to clear with a backspace.
Upvotes: 4
Reputation: 566
I have found the solution by myself. To be specific, I'll explain the scenario once again. I have a server socket running in android emulator, and a client in my host machine. BTW, both client and emulator runs on the same machine. I used 'localhost' to reach the server(running in emulator). And to forward the port, I used
adb forward tcp:hostport tcp:guestport
According to my example, the command will be
adb forward tcp:4000 tcp:3000
Upvotes: 3