无法“ping”使用 adb 或 android studio 从 android 进行本地网络
我正在尝试在我的应用程序中建立 tcp 连接,并在具有本地 IP 的 VM 主机上测试它。 在主机上,我打开一个 TCP 端口 4444。
为了测试为什么无法建立连接,我决定首先尝试一个简单的“ping”。 在主机上我这样做”
C:\WINDOWS\system32>ping -c 1 192.168.1.66
Pinging 192.168.1.66 with 32 bytes of data:
Reply from 192.168.1.66: bytes=32 time<1ms TTL=64
Reply from 192.168.1.66: bytes=32 time<1ms TTL=64
Reply from 192.168.1.66: bytes=32 time<1ms TTL=64
Reply from 192.168.1.66: bytes=32 time<1ms TTL=64
Ping statistics for 192.168.1.66:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
一切都很好,但是使用 adb:
C:\Users\XXX>adb shell "/system/bin/ping -c 1 192.168.1.66"
PING 192.168.1.66 (192.168.1.66) 56(84) bytes of data.
From 10.0.2.2: icmp_seq=1 Destination Port Unreachable
--- 192.168.1.66 ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms
为什么无法从 Android 设备访问目的地以及如何解决此问题? 我尝试关闭 AV,结果相同。
I am tryin to establish tcp connection in my app and test it on VM host with local IP.
On the host I open a tcp port 4444.
To test why the connection cannot be established I decided to first try a simple 'ping'.
On the Host I do"
C:\WINDOWS\system32>ping -c 1 192.168.1.66
Pinging 192.168.1.66 with 32 bytes of data:
Reply from 192.168.1.66: bytes=32 time<1ms TTL=64
Reply from 192.168.1.66: bytes=32 time<1ms TTL=64
Reply from 192.168.1.66: bytes=32 time<1ms TTL=64
Reply from 192.168.1.66: bytes=32 time<1ms TTL=64
Ping statistics for 192.168.1.66:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
All is well, however with adb:
C:\Users\XXX>adb shell "/system/bin/ping -c 1 192.168.1.66"
PING 192.168.1.66 (192.168.1.66) 56(84) bytes of data.
From 10.0.2.2: icmp_seq=1 Destination Port Unreachable
--- 192.168.1.66 ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms
Why is the destination not reachable from the android device and how to fix this?
I tried with my AV off and the result the same.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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