How to send raw data from Android device to host?
I am trying to send some data (in the form of raw bytes ) from my device to host(connected through USB). What can be the different ways to do it ??
One idea is to write the raw bytes in one of the ring buffers (in /dev/log/) and let the logcat read it. But logcat expects the format开发者_StackOverflowted strings in ring buffers, Is there a way to modify the behavior of logcat ??
or is there a way to create a tcp connection between host and device to transfer the data???
Any other suggestions ??
Thanks.
adb forward
is your friend. You can do port forwarding and then run TCP servers on either the host or the device.
EDIT: see http://developer.android.com/guide/developing/tools/adb.html#forwardports for more detail.
精彩评论