通过 USB 电缆从 PC 到真正的 Android 手机进行通信

发布于 2025-01-06 17:17:46 字数 496 浏览 3 评论 0原文

这些天我尝试通过 USB 电缆将数据(流)从 Android 移动设备发送到 PC,

我做得很好,android 模拟器上的套接字(“10.0.2.2”,6543)将数据流发送到 ServerSocket (6543) 在 PC 上,之前我运行过“adbforward tcp:12345 tcp:6543”。

但是当我在真实的 Android-Mobile 上设置套接字(“10.0.2.2”,6543)并在 PC 上设置 serverSocket 时,Android-Mobile 上的套接字无法将数据发送到 PC 上的 ServerSocket。

请帮我。为什么我无法使用 Android-Mobile 上的套接字向 PC 上的 ServerSocket(6543) 发送数据?真实设备和 Android 模拟器有什么不同。或者IP设置错误?如何通过USB ADB获取PC的IP?

另一方面,我将数据作为套接字和服务器套接字从 PC 发送到真正的 Android 移动设备。

感谢大家的关注!

These days I try and try to send data(stream) from an Android-Mobile to a PC VIA USB cable,

I made it good that a socket("10.0.2.2", 6543) on the android emulator sending data stream to a ServerSocket(6543) On a PC , before which I had run "adb forward tcp:12345 tcp:6543".

But when I setup a socket("10.0.2.2", 6543) on a REAL Android-Mobile and a serverSocket on the PC, the socket on the Android-Mobile can NOT send data to the ServerSocket on the PC.

Please help me. Why can't I use the socket on the Android-Mobile to send data to the ServerSocket(6543) on the PC. What is the different between the REAL device and the android emulator. Or , is the IP setted to be wrong? How can I get the IP of the PC VIA USB ADB?

On the other hand, I make it out to send data from a PC to a REAL Android-Mobile as socket and serverSocket.

Thx all for focusing!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文