How to get sent/received bytes count by network adapter in C++/WinAPI

c++, winapi, windows

Solution

Look into the function `GetTcpStatistics` and related ones (`GetUdpStatistics` etc.).

On second thought: performance counters would probably provide another method that is more tailored to your needs. This can also be queried via WMI (`Win32_PerfFormattedData_Tcpip_NetworkInterface`).

Problem

How to get sent/received bytes count by network adapter in C++/WinAPI? My programming platform is Windows.

Original source