-
-
Save KeithNdhlovu/41c9fb5503ee5f2d3154ae41370cac15 to your computer and use it in GitHub Desktop.
adb forward ports
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
adb: implement "adb reverse <local> <remote>" | |
This implements the logical opposite of 'adb forward', i.e. | |
the ability to reverse network connections from the device | |
to the host. | |
This feature is very useful for testing various programs | |
running on an Android device without root or poking at the | |
host's routing table. | |
Options and parameters are exactly the same as those for | |
'adb forward', except that the direction is reversed. | |
Examples: | |
adb reverse tcp:5000 tcp:6000 | |
connections to localhost:5000 on the device will be | |
forwarded to localhost:6000 on the host. | |
adb reverse --no-rebind tcp:5000 tcp:6000 | |
same as above, but fails if the socket is already | |
bound through a previous 'adb reverse tcp:5000 ...' | |
command. | |
adb reverse --list | |
list all active reversed connections for the target | |
device. Note: there is no command to list all | |
reversed connections for all devices at once. | |
adb reverse --remove tcp:5000 | |
remove any reversed connection on the device from | |
localhost:5000 | |
adb reverse --remove-all | |
remove all reversed connections form the current | |
device. | |
Reversed connections are tied to a transport, in other | |
words, they disappear as soon as a device is disconnected. | |
Simple testing protocol: | |
adb forward tcp:5000 tcp:6000 | |
adb reverse tcp:6000 tcp:7000 | |
nc -l localhost 7000 | |
in another terminal: | |
echo "Hello" | nc localhost 5000 | |
Will print "Hello" on the first terminal. |
**Simple testing protocol:
adb forward tcp:5000 tcp:6000
adb reverse tcp:6000 tcp:7000
nc -l localhost 7000
in another terminal:
echo "Hello" | nc localhost 5000
Will print "Hello" on the first terminal**
Above testing protocol is not working. On another terminal nc -l localhost 7000 that got kill nothing is display.
Thanks for sharing the tips.
I've tested with nc localhost 5000
( and type some text ) instead of echo "Hello" | nc localhost 5000
,
then print in another terminal.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What are host and devices actually? On adb there's a distinction between client, server and daemon