У меня есть этот код:
//network
PerformanceCounter NetRead = null;
PerformanceCounter NetWrite = null;
int IntNetRec = 0;
int IntNetSent = 0;
foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
{
try
{
NetRead = new PerformanceCounter("Network Interface", "Bytes Received/sec", $"{nic.Description}");
NetWrite = new PerformanceCounter("Network Interface", "Bytes Sent/sec", $"{nic.Description}");
moocall = NetRead.NextValue(); // Remove the 0
moocall = NetWrite.NextValue(); // Remove the 0
Thread.Sleep(200);
IntNetRec = IntNetRec + (int)NetRead.NextValue();
IntNetSent = IntNetSent + (int)NetWrite.NextValue();
}
catch
{
continue;
}
Но я не получаю свою производительность сети в выводе / вводе в таблице, которую я имею. Он просто говорит ZERO.
Я вижу, что мой адаптер беспроводной сети поднимается и опускается и получает данные ... Но почему он не отображается?
Хмм