Hello,
I wrote the following code:
NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces();
while (true)
{
System.Console.WriteLine(adapters[0].OperationalStatus);
Thread.Sleep(1000);
}
As you can see the code prints the network adapter's status every 1 sec.
When an Ethernet cable is connected, the print is "Up".
But when I disconnected the cable, the print continues to be "Up".
If I start over when the link is down, the print changes to "Down" but not online when the program runs.
Can you help ?
Best regards,
Z.V
No comments:
Post a Comment