Android中的USB数据线通讯 [英] Usb data cable communication in Android

查看:110
本文介绍了Android中的USB数据线通讯的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用USB数据线从我的计算机与我的android应用程序进行通信.我应该实现什么监听器?

I want to communicate with my android application from my computer with the usb data cable. What listener should I implement?

我认为TCP连接可以满足我的需求,但通过adb驱动程序进行连接似乎很麻烦.

I think a TCP connection will suit my needs but connecting with it over the adb driver seems akward.

如何使用数据线从Windows与android通信?

How can I communicate from windows to android using a data cable?

推荐答案

我找到了关于此主题的好帖子

I found a nice post about this subject here. You basically need adb in order to do the port forwarding between the Android device and the PC. As an example:

C:\android-sdk-windows\tools\adb.exe forward tcp:38300 tcp:38300

然后,您可以在Android设备和PC中使用标准的套接字编程.

Then you can use standard socket programming, both in the Android device and in the PC.

这篇关于Android中的USB数据线通讯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆