[Mono-list] System.Net.NetworkInformation: network availability
m.vitturi at gmail.com
Mon Jan 10 03:34:51 EST 2011
Please welcome my first message in here and forgive my lack of knowledge on
I'm working on a multi-platform software which is primarily developed on C#
This application needs to recognize if it is working online or offline so on
my Windows side I added this lines of code:
var netState = NetworkInterface.GetIsNetworkAvailable();
NetworkChange.NetworkAvailabilityChanged += OnNetworkAvailabilityChanged;
Console.WriteLine(netState ? "Net is available" : "Net is not available");
...where OnNetworkAvailabilityChanged is implemented in this way:
private static void OnNetworkAvailabilityChanged(object sender,
Console.WriteLine(args.IsAvailable ? "Net is available" : "Net is not
but ... well, it doesn't work under Mono, where with the Microsoft .Net
framework runs nicely.
GetIsNetworkAvailable always returns true and no events are thrown when I
plug on or off the cable.
Am I doing something wrong? I tried the same code with Mono 2.6.7 and 2.8.1.
Is there anyone working on implementing this features of
System.Net.NetworkInformation or there aren't plans about them?
Can you suggest me any workaround or library to do what I need?
I'd prefer to avoid pinging some servers cause the number of pings can turn
on a waste of resources between our servers and workstations.
Thank you for your kind attention,
View this message in context: http://mono.1490590.n4.nabble.com/System-Net-NetworkInformation-network-availability-tp3206752p3206752.html
Sent from the Mono - General mailing list archive at Nabble.com.
More information about the Mono-list