开发者

How to determine primary network adapter in results from PdhExpandWildCardPath?

My goal is to measure the average Bytes received per second using the Windows performance counter API. My problem is that, when there are multiple network adapters, I don't know which one is the "primary" one (i.e. the one used for Internet and LAN traffic).

I can pass "\Network Interface(*)\Bytes Received/sec" to PdhExpandWildCardPath() and get a list back, but that list seems to be in alphabetical order, not routing order. And the names returned by PdhExpandWildCardPath() don't seem to be the same as the ones the WMI functions use -- Pdh seems to add "Packet Scheduler Miniport" -- so even if I went that route I'm not sure how to correlate the infor开发者_如何学Gomation from the different APIs.


Which network adapter is 'Primary' is a qualitative judgment. A computer might have both onboard wireless 802.11, and wired Ethernet adapters, either of which could be primary at any given time (or even at the same time).

You are probably going to have to use the IP Helper API to determine which you prefer and correlate that with the PerfMon ouput. or you could just pick the one with the most activity and call it primary. That's just the kind of value judgment that PerfMon cannot possibly make, as these stats are transparent to it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜