I need a way to get the current system network usage, up and down.
I found some on the net but they\'re not working out for me.
Thanks for your help
Code
You can get the current system's network usage by working with PerformanceCounterCategory too:
using System;
using System.Diagnostics;
class Program
{
static void Main()
{
PerformanceCounterCategory pcg = new PerformanceCounterCategory("Network Interface");
string instance = pcg.GetInstanceNames()[0];
PerformanceCounter pcsent = new PerformanceCounter("Network Interface", "Bytes Sent/sec", instance);
PerformanceCounter pcreceived = new PerformanceCounter("Network Interface", "Bytes Received/sec", instance);
Console.WriteLine("Bytes Sent: {0}", pcsent.NextValue() / 1024);
Console.WriteLine("Bytes Received: {0}", pcreceived.NextValue() / 1024);
}
}
Source: http://dotnet-snippets.com/snippet/show-network-traffic-sent-and-received/580