Sunday, July 6, 2014

adb port forwarding via USB



Here is a way to create a socket connection between Android phone and Ubuntu 14.04 desktop.

Pre-requites:
1. Android Terminal Emulator App (On Android Device)
2. Android SDK installed on host computer

create a socket on the device using nc command:
jai@jai-server:~$ adb shell
shell@mako:/ $ nc -l -p 1234
---//
The above command could be executed on the terminal Emulator as follows:



On the host machine:
jai@jai-server:~$ adb forward tcp:1235 tcp:1234
jai@jai-server:~$ nc localhost 1235
--//
Connection is established and you are good to go. Start writing on any of the device. It should be reflected on other device.

Reference: http://bharathisubramanian.wordpress.com/2012/03/10/android-socket-communication-thru-adb/

No comments:

Post a Comment