开发者

is serial communication is possible in android via USB

开发者 https://www.devze.com 2023-04-01 11:01 出处:网络
I am using USB and connect it to the android device and 开发者_StackOverflow中文版Pc..can I send message from Pc to device and Device to pc?

I am using USB and connect it to the android device and 开发者_StackOverflow中文版Pc..can I send message from Pc to device and Device to pc? Please help me

Thanks


The most straightforward way to communicate between an android device and a PC is either to use an Internet service, or to connect the android device to the same wifi access point as the PC and use normal TCP networking methods.

If USB debugging is enabled on the android device and it is connected to a pc with the ADB tool from the sdk, then you can set up an ADB port forward. This will allow the PC to make a TCP connection to the android device, and then bidirectional traffic can flow. However, the port forward does not itself allow the android device to initiate a connection to the PC, though you can accomplish this by setting up tunneling (potential with ssh or some other solution).

Some implementations of tethering (use the android device to provide Internet to the PC) have the side effect of establishing a general network connection between the android device and the PC, at which point either side could potentially initiate a connection. However, it would take some customization to keep the PC from trying to do its networking through the android device, potentially using up your mobile service plan unnecessarily.

0

精彩评论

暂无评论...
验证码 换一张
取 消