NetworkInterface.OperationalStatus is not updating while program runs
hello,
i wrote following code:
networkinterface[] adapters = networkinterface.getallnetworkinterfaces(); while (true) { system.console.writeline(adapters[0].operationalstatus); thread.sleep(1000); } as can see code prints network adapter's status every 1 sec.
when ethernet cable connected, print "up".
but when disconnected cable, print continues "up".
if start on when link down, print changes "down" not online when program runs.
can ?
best regards,
z.v
hello,
i think code should be:
while (true) { networkinterface[] adapters = networkinterface.getallnetworkinterfaces(); system.console.writeline(adapters[0].operationalstatus); thread.sleep(1000); } with code, when disconnect cable while program running, current status printed.
best regards,
z.v
Visual Studio Languages , .NET Framework > Visual C#
Comments
Post a Comment