如何从 Windows 程序访问类似 netstat 的以太网统计信息 [英] How can I access netstat-like Ethernet statistics from a Windows program

查看:31
本文介绍了如何从 Windows 程序访问类似 netstat 的以太网统计信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从 C/C++ 代码(如 netstat -e)访问以太网统计信息?

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

Interface Statistics

                       Received            Sent

Bytes                      21010071        15425579
Unicast packets               95512           94166
Non-unicast packets           12510               7
Discards                          0               0
Errors                            0               3
Unknown protocols                 0

推荐答案

GetIpStatistics 在 Windows IPHelper 函数中调用.

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.需要在计算机上启用 SNMP,但显然也可用于检索远程计算机的统计信息.
  • 将netstat"的输出通过管道传输到您的应用程序中,并从文本中取消选择值.

这篇关于如何从 Windows 程序访问类似 netstat 的以太网统计信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆