• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# netstat
2
3
4## Command Function
5
6The **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 connections and can be used to check the network connection to each port on a device (board).
7
8
9## Syntax
10
11netstat
12
13
14## Parameters
15
16None.
17
18
19## Usage Guidelines
20
21None.
22
23## Note
24
25Currently, the shell does not support this command.
26
27## Example
28
29Run **netstat**.
30
31
32## Output
33
34**netstat** output information:
35
36```
37OHOS # netstat
38========== total sockets 128 ======  unused sockets 119 ==========
39Proto   Recv-Q      Send-Q      Local Address           Foreign Address         State
40tcp     0           0           192.168.1.10:578        192.168.1.3:2049        ESTABLISHED
41tcp     0           0           192.168.1.10:58653      0.0.0.0:0               LISTEN
42tcp     0           0           192.168.1.10:58652      0.0.0.0:0               LISTEN
43tcp     0           0           192.168.1.10:58651      0.0.0.0:0               LISTEN
44Proto   Recv-Q      Send-Q      Local Address           Foreign Address
45udp     0           0           127.0.0.1:62177         127.0.0.1:62178
46udp     0           0           0.0.0.0:5684            0.0.0.0:0
47udp     0           0           127.0.0.1:62179         127.0.0.1:62180
48udp     0           0           127.0.0.1:62180         127.0.0.1:62179
49udp     0           0           127.0.0.1:62178         127.0.0.1:62177
50```
51
52**Table 1** Output description
53
54| Parameter                | Description                                                        |
55| -------------------- | ------------------------------------------------------------ |
56| Proto                | Protocol type.                                                  |
57| Recv-Q               | Amount of data that is not read by the user.<br>For Listen TCP, the value indicates the number of TCP connections that have finished the three-way handshake but are not accepted by users. |
58| Send-Q               | For a TCP connection, this value indicates the amount of data that has been sent but not acknowledged.<br>For a UDP connection, this value indicates the amount of data buffered before IP address resolution is complete.|
59| Local&nbsp;Address   | Local IP address and port number.                                            |
60| Foreign&nbsp;Address | Remote IP address and port number.                                            |
61| State                | TCP connection status. This parameter is meaningless for UDP.                                |
62
63> **NOTE**<br>
64> 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.
65