Test Android network connectivity from abd shell
Usually network connectivity can be tested with ping and telnet. Android adb shell has ping but no telnet. But it has nc, which can be used in place of telnet.
# nc -z -v www.google.com 80 DNS fwd/rev mismatch: www.l.google.com != tul01m01-in-f105.1e100.net DNS fwd/rev mismatch: www.l.google.com != tul01m01-in-f99.1e100.net DNS fwd/rev mismatch: www.l.google.com != tul01m01-in-f147.1e100.net DNS fwd/rev mismatch: www.l.google.com != tul01m01-in-f104.1e100.net DNS fwd/rev mismatch: www.l.google.com != tul01m01-in-f106.1e100.net DNS fwd/rev mismatch: www.l.google.com != tul01m01-in-f103.1e100.net www.l.google.com [74.125.73.105] 80 (www) open # # nc -z -v -w 5 www.google.com 81 DNS fwd/rev mismatch: www.l.google.com != tul01m01-in-f99.1e100.net DNS fwd/rev mismatch: www.l.google.com != tul01m01-in-f147.1e100.net DNS fwd/rev mismatch: www.l.google.com != tul01m01-in-f106.1e100.net DNS fwd/rev mismatch: www.l.google.com != tul01m01-in-f105.1e100.net DNS fwd/rev mismatch: www.l.google.com != tul01m01-in-f104.1e100.net DNS fwd/rev mismatch: www.l.google.com != tul01m01-in-f103.1e100.net www.l.google.com [74.125.73.99] 81 (?) : Connection timed out # # nc -h [v1.10] connect to somewhere: nc [-options] hostname port[s] [ports] ... listen for inbound: nc -l -p port [-options] [hostname] [port] options: -g gateway source-routing hop point[s], up to 8 -G num source-routing pointer: 4, 8, 12, ... -h this cruft -i secs delay interval for lines sent, ports scanned -l listen mode, for inbound connects -n numeric-only IP addresses, no DNS -o file hex dump of traffic -p port local port number -r randomize local and remote ports -s addr local source address -u UDP mode -v verbose [use twice to be more verbose] -w secs timeout for connects and final net reads -z zero-I/O mode [used for scanning] port numbers can be individual or ranges: lo-hi [inclusive] #
浙公网安备 33010602011771号