Issue
I know it is possible to forward a port from my develop machine to an Android emulator, but how is this done? I've found the solution on the android-developers site, but I couldn't see how they've meant their instructions... Anybody got some clear instructions on this? My develop machine is running Windows.
Solution
To forward a port from your local machine to an Android Emulator, you need to have Telnet enabled. This is done through the Control Panel -> Programs and Features -> Turn Windows features on or off -> scroll down to Telnet Client. Then select it & press Ok. Now from your command prompt (with the Emulator running) you type telnet localhost "EmulatorPortNumber"
. The "EmulatorPortNumber" can be found in the titlebar of the Emulator, in my case it was 5554.
You will now see something similar to this:
Android Console: type 'help' for a list of commands
OK
Here, you want to type with as little as possible typo's, as when you apply the backspace, it will corrupt your command and not accept it. The command you have to use here is redir
. This will let you choose from 3 subcommands:
list list current directions
add add new redirection
del remove existing redirection
The one you need now is add. But you can't use it just like that. Typing redir add
will give you the following line:
KO: bad redirection format, try (tcp|udp):hostport:guestport
This means that you have to specify what kind of port you want to forward (TCP or UDP port), which port on the local machine you want to forward (hostport) & which port you want to set on the Emulator (guestport). So, using a command like this:
redir add udp:1337:12345
forwards the UDP port 1337 on the local machine to port 12345 on the Emulator. Be cautious about deleting redirections, as they might crash your Emulator. You can also simply close the Emulator to remove any redirections. It's easier & safer...
Answered By - ThaMe90
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.