README.rst
1.. zephyr:code-sample:: net-stats
2 :name: Network statistics
3 :relevant-api: net_stats
4
5 Query and display network statistics from a user application.
6
7Overview
8********
9
10This sample shows how to query (and display) network statistics from a user
11application.
12
13The source code for this sample application can be found at:
14:zephyr_file:`samples/net/stats`.
15
16Requirements
17************
18
19- :ref:`networking_with_host`
20
21Building and Running
22********************
23
24A good way to run this sample application is with QEMU or native_sim board
25as described in :ref:`networking_with_host`.
26
27Follow these steps to build the network statistics sample application:
28
29.. zephyr-app-commands::
30 :zephyr-app: samples/net/stats
31 :board: <board to use>
32 :conf: prj.conf
33 :goals: build
34 :compact:
35
36If everything is configured correctly, the application will periodically print
37current network statistics to the console.
38
39.. code-block:: console
40
41 Global network statistics
42 IPv6 recv 27 sent 8 drop 0 forwarded 0
43 IPv6 ND recv 2 sent 5 drop 2
44 IPv6 MLD recv 0 sent 3 drop 0
45 IPv4 recv 20 sent 0 drop 20 forwarded 0
46 IP vhlerr 0 hblener 0 lblener 0
47 IP fragerr 0 chkerr 0 protoer 0
48 ICMP recv 15 sent 3 drop 13
49 ICMP typeer 0 chkerr 0
50 UDP recv 0 sent 0 drop 30
51 UDP chkerr 0
52 TCP bytes recv 0 sent 0
53 TCP seg recv 0 sent 0 drop 0
54 TCP seg resent 0 chkerr 0 ackerr 0
55 TCP seg rsterr 0 rst 0 re-xmit 0
56 TCP conn drop 0 connrst 0
57 Bytes received 7056
58 Bytes sent 564
59 Processing err 1
60