且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从 PC 向 Android 手机发送命令 - 通过物理连接(USB、串行等)

更新时间:2022-11-26 16:40:32

在您的应用中实现 HTTP 服务器,然后将手机置于 USB Tether 模式.这将在您的手机和 PC 之间创建一个本地网络.然后,您应该能够使用手机的 ip 发送 HTTP 请求或创建 websocket.

Implement a HTTP server in your app, then put your phone in USB Tether mode. This will create a local network between your phone and your PC. You should then be able to send HTTP request or create websockets using the phone's ip.

我对其进行了测试,它可以工作,请参阅 这里

EDIT : I tested it, and it works, see here