eKKiM
eKKiM

Reputation: 431

C Windows - Get IPv4 bandwidth usage Statistics

With the .NET Framework we can retrieve the received and sent bytes with the following functions.

NetworkInterface.GetIPv4Statistics().BytesReceived
NetworkInterface.GetIPv4Statistics().BytesSent

But i cannot find the alternative in native C. The closest i found was the GetIpStatistics. However this seems to be global instead of per interface.

Can anyone point me into the right direction?

Upvotes: 1

Views: 152

Answers (1)

Nomad
Nomad

Reputation: 172

Allthough we can all furiously debate what the correct terminology is, I think you can find what you seek by calling the GetIfTable function.

This will return a MIB_IFTABLE struct, which in turn has MIB_IFROW elements that contain the data you're looking for for the various network interfaces on your machine.

Upvotes: 1

Related Questions