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

The WMI will provide those readings:

SELECT * FROM Win32_PerfFormattedData_Tcpip_IP
SELECT * FROM Win32_PerfFormattedData_Tcpip_TCP
SELECT * FROM Win32_PerfFormattedData_Tcpip_UDP
SELECT * FROM Win32_PerfFormattedData_Tcpip_ICMP
SELECT * FROM Win32_PerfFormattedData_Tcpip_Networkinterface

These classes are available on Windows XP or newer. You may have to resign to the matching “Win32_PerfRawData” classes on Windows 2000, and do a little bit more of math before you can display the output.

Find documentation on all of them in the MSDN.

Leave a Comment