以太网信息
好吧,我在 MSDN 上查看了有关此内容的信息,只发现了这个: GetAdaptersAddresses
我想要获取的是以太网信息,例如描述、发送的字节数、接收的字节数、带宽、延迟等。这可能吗?
Well, i've looked on MSDN about this an only found this: GetAdaptersAddresses
And what i'm trying to get is the Etherned Information, such as Description, Bytes Sent, Bytes Received, Bandwidth, Latency, etc. It's possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过
GetIfTable2 获得大部分内容
和GetIfEntry2
。如果您需要与 XP 及更早版本兼容,则需要查看GetIfTable
和GetIfEntry
代替。*2
函数提供了更多信息,但仅适用于 Vista 及更高版本。我不相信两者都会显示延迟——因为你几乎需要做一些测量。同样,带宽只是适配器的额定带宽(例如,100 Mb/s 或1000 Mb/s),而不是与任何特定主机通信时所期望的带宽。
编辑:这是我周围的一些代码,它们应该显示如何使用这些函数的总体思路:
You can get most of that with
GetIfTable2
andGetIfEntry2
. If you need compatibility with XP and earlier, you'll want to look atGetIfTable
andGetIfEntry
instead. The*2
functions give more information, but only work on Vista and newer.I don't believe either will show latency though -- for that you pretty much need to do some measuring. Likewise, the bandwidth will be simply the rated bandwidth of the adapter (e.g., 100 Mb/s or 1000 Mb/s), not what you can necessarily expect when communicating with any particular host.
Edit: Here's some code I had lying around that should show the general idea of how to use these functions: