Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

NetworkAvailabilityEventChanged event handler not working?

netduino microframework

  • Please log in to reply
No replies to this topic

#1 Emilio x64

Emilio x64

    Advanced Member

  • Members
  • PipPipPip
  • 40 posts

Posted 24 August 2013 - 02:55 AM

In doing my netduino networking code (UDP & TCP) I tried something that was suggested back in 4.2 to detect when the connection is broken due to the inherent limitations of the NETMF.

 

It was proposed to use the NetworkInformation.NetworkAvailabilityChanged event handler. Basically one defines the delegate method and in there depending on the e.IsAvailable property one would stop or resume network operations (tx/rx).

Microsoft.SPOT.Net.NetworkInformation.NetworkChange.NetworkAvailabilityChanged += new Microsoft.SPOT.Net.NetworkInformation.NetworkAvailabilityChangedEventHandler(NetworkAvailabilityChangedHandler);

I have no hardware yet so I was trying it on the emulator which is supposed to have already a "connection" to the host system. I placed a breakpoint on that event handler method but it never gets called.

private void NetworkAvailabilityChangedHandler(object sender, Microsoft.SPOT.Net.NetworkInformation.NetworkAvailabilityEventArgs e)        {            lock (this.threadLock)            {                if (e.IsAvailable)                {                    StartServices();                }                else                {                    StopServices();                }            }        }






Also tagged with one or more of these keywords: netduino, microframework

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.