Hello,
I think the code should be:
while (true)
{
NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces();
System.Console.WriteLine(adapters[0].OperationalStatus);
Thread.Sleep(1000);
}
With this code, when I disconnect the cable while program is running, the current status is printed.
Best regards,
Z.V
No comments:
Post a Comment