通过 USB 电缆从 PC 到真正的 Android 手机进行通信
这些天我尝试通过 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论