Tuesday 4 June 2019

ADB Network Commands

1. adb shell netstat

In computing, netstat (network statistics) is a command-line network utility tool that displays network connections for the Transmission Control Protocol (both incoming and outgoing).
adb netstat command is used for network statistics . This command is usually required to analyse the network statistics for an android device. Below pic shows the actual output of the command

netstat

2. adb shell ping 

PING command returns the network response if the device is connected to INTERNET. Ping command can be used with below options

ping [-c count]
        [-i interval]
        [-I interface]
        [-m mark]
        [-M pmtudisc_option]
        [-l preload]
        [-p pattern]
        [-Q tos]
        [-s packetsize]
        [-S sndbuf]
        [-t ttl]
        [-T timestamp_option]
        [-w deadline]
        [-W timeout]

The output of the adb shell ping command will be as below

ping

Ctrl+c is used to stop the ping command. You can also give give limited lines to be displayed on screen as a result of ping command.

adb shell ping www.facebook.com -c 4
3.  adb shell netcfg

adb shell netcfg command is used to show, manipulate routing, configure and manage network connections via profiles. Below is the result of netcfg command

netcfg
4. adb shell ip

adb shell ip command show, manipulate routing, devices, policy routing and tunnels

ip [OPTIONS ] OBJECT
OBJECT := { link | addr | addrlabel | route | rule | neigh | ntable |tunnel | tuntap | maddr | mroute | mrule | monitor| xfrm |netns | l2tp }

OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |-f[amily] { inet | inet6 | ipx | dnet | link } |-l[oops] { maximum-addr-flush-attempts } |-o[neline] | -t[imestamp] | -b[atch] [filename] |-rc[vbuf] [size]}

Example: adb shell ip -f inet addr show wlan0
                (show WiFi IP Address)





1 comment:

Feature Posts

Python Appium - Step by step procedure for capturing screenshot

 Why To capture screenshot? It is as important as your logs. If there is any failure for any test scenario, we can provide screenshot for th...