How can I access netstat-like Ethernet statistics from a Windows program

前端 未结 7 2010
臣服心动
臣服心动 2020-12-03 16:11

How can I access Ethernet statistics from C/C++ code like netstat -e?

Interface Statistics

                       Received            Sent
         


        
7条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-03 16:38

    A good place to start for network statistics would be the GetIpStatistics call in the Windows IPHelper functions.

    There are a couple of other approaches that are possibly more portable:-

    • SNMP. Requires SNMP to be enabled on the computer, but can obviously be used to retrieve statistics for remote computers also.
    • Pipe the output of 'netstat' into your application, and unpick the values from the text.

提交回复
热议问题