0

I've got an small program that is written in VB.NET and compiled with .NET4. When I run it on win7 and unplug my network cable, I have an event. when I run the program on Ubuntu V12.10 and mono, I do not have any reaction when the network cable is unplugged?

Does anyone has some suggestions or solution?

I use the applicationevents.vb form in VB.Net 2012 with the trigger:

Private Sub MyApplication_NetworkChange() Handles Me.NetworkAvailabilityChanged

Thank you very much.

3
  • 1
    I'm pretty sure that the calls/events in the Windows and Linux kernel are totally different and (most likely) not portable. I would suggest to review your program. Also, I would use Network Manager instead.
    – Braiam
    Aug 31, 2013 at 13:13
  • @Braiam I don't see what this has to do with kernels; a CLR implementation (like Mono), similar to a Java VM, should abstract over all that. I see no a priori reason why the event shouldn't be raised in Mono. Aug 31, 2013 at 16:33
  • Describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
    – Braiam
    Aug 31, 2013 at 17:15

1 Answer 1

0

From vbforums, there are two possible answers, from jmcilhinney. One says:

I'm not 100% sure but I think it likely that that NetworkAvailabilityChanged event is presumably a wrapper for the NetworkChange.NetworkAvailabilityChanged event. The documentation for that event says:

The NetworkChange class raises NetworkAvailabilityChanged events when the availability of the network changes. The network is available when at least one network interface is marked "up" and is not a tunnel or loopback interface.

Presumably you have at least one non-tunnel or loopback network interface marked as "up", even when you unplug your network cable.

and the other:

My guess would be that it uses a Windows-specific API under the hood that is not available on Linux and either has no analogue or at least it hasn't been implemented in Mono.

There is also this question in StackOverflow that has no answer still. I was reading the source code of mono, trying to figure out this issue. Although it has a LinuxNetworkChange () function, I didn't saw what the problem is (and I'm not too familiarized with mono).

Either way, since you didn't say that the program was firing an error, it could be that it wasn't catch or mono doesn't listen at all for it. A more robust search lies ahead.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .