netstat
Command Function
The netstat command is a console command and is used for monitoring the TCP/IP network. It can display the actual network connections and the status of each network interface device. This command displays statistics related to TCP and UDP and can be used to check the network connection to each port on the device (board).
Syntax
netstat
Parameters
None
Usage
netstat
Example
Run netstat.
Output
netstat print information
OHOS # netstat
========== total sockets 128 ====== unused sockets 119 ==========
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 192.168.1.10:578 192.168.1.3:2049 ESTABLISHED
tcp 0 0 192.168.1.10:58653 0.0.0.0:0 LISTEN
tcp 0 0 192.168.1.10:58652 0.0.0.0:0 LISTEN
tcp 0 0 192.168.1.10:58651 0.0.0.0:0 LISTEN
Proto Recv-Q Send-Q Local Address Foreign Address
udp 0 0 127.0.0.1:62177 127.0.0.1:62178
udp 0 0 0.0.0.0:5684 0.0.0.0:0
udp 0 0 127.0.0.1:62179 127.0.0.1:62180
udp 0 0 127.0.0.1:62180 127.0.0.1:62179
udp 0 0 127.0.0.1:62178 127.0.0.1:62177
Table 1 Output description
NOTE: The command output like "========== total sockets 32 ====== unused sockets 22 BootTime 27 s ==========" indicates that there are 32 sockets in total, 22 sockets are not used, and it has been 27 seconds since the system starts.