Right now, I want to check whether the android device can connect to another device via the net. I can use the browser to log into the internet. But when I use adb shell
to connect to the android emulator and use the ping
command to connect to the host, it fails.
kaiwii@ubuntu:~$ adb shell ping 192.168.145.136 PING 192.168.145.136 (192.168.145.136) 56(84) bytes of data. ^C
(192.168.145.136 is the host's ip!)
But when I ping 127.0.0.1, it works. So, I am definitely sure the device supports the ping command. I am just confused why it can not ping the host while I can log into the internet in the browser. What's more, anyone can show any other method to check network ability in android?
Thanks
adb shell ping -c1 www.google.com
will return below response if device has internet
PING www.google.com (xx.xx.xx.xx) 56(84) bytes of data.
64 bytes from (xx.xx.xx.xx): icmp_seq=1 ttl=61 time=25.3 ms
--- www.google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 25.332/25.332/25.332/0.000 ms
or else
ping: unknown host www.google.com