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.

phil's Content

There have been 4 items by phil (Search limited from 29-March 23)


By content type

See this member's

Sort by                Order  

#33200 Crash on network socket unplug

Posted by phil on 07 August 2012 - 05:41 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi,
this is not working for me. I'm using 4.2 RC5 and the event about network up/down is not propageted. Anybody using RC5 too?
thanks
jan


Sorry, I can't help you. I gave up after a rude personal email from Chris. I literally threw all the netduinos my company used in the garbage bin and replaced them with devices from GHI, and use those plus custom hardware exclusively now. That's the only recommendation I can make, but someone else may have found fixes in the 4.2 RCs.



#18565 Crash on network socket unplug

Posted by phil on 28 September 2011 - 11:28 PM in Netduino Plus 2 (and Netduino Plus 1)

I chose to change my arduinos with netduinos to add ethernet to my projects. If thought multi-thread can avoid hangs caused by network delay. I was desapointed when I saw my netduino hangs when I unplugged the cable...

I hoped that the netduino hang until the connect timeout raise. I didn't have the time to test it and I really need my input interruption been catch even when I try to send networks request so I let it untouched.

In the test of the first post, is the catching of the exception still in the main loop ?

It seems that Secret Labs is confident about resolving the issue in the next 4.2 firmware, so it may not be an hardware problem. We just have to wait ... RC3 is annonced in few days (weeks ?)


Thanks, Ricco. So, this is a known issue? I've been trying to find info in the forums about betas, etc, but it's really hard to dig through.

This is only an issue where the cable is unplugged when the device is powered on. If the cable is plugged in when it is powered up, you can add some code like this:

static bool networkAvailable = true;

void main()
{
   NetworkChange.NetworkAvailabilityChanged += 
      new NetworkAvailabilityChangedEventHandler(NetworkChange_NetworkAvailabilityChanged);
   while (true)
   { 
      while(!detect_Event());
      if (networkAvailable)
      {
         using (socket = ConnectToServer())
         {
            SendMessage();
            DoOtherStuff();
         }
      }
   }
}

static void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
{
    Debug.Print("Network Availability Changed : IsAvailable = " + e.IsAvailable.ToString());
    networkAvailable = e.IsAvailable;
}



#18542 Crash on network socket unplug

Posted by phil on 28 September 2011 - 10:41 AM in Netduino Plus 2 (and Netduino Plus 1)

It would be a lot easier if there was a simple way to get at whatever is being used by the NetworkChange class to detect a change in the network availability. I can use that to prevent attempting to connect if the network cable is pulled out *after* the program starts, but not to detect if it is not up *when* the program starts. There is a nice pin (14) that would be perfect on the Ethernet PHY that's not connected to anything. I'd love to know why that decision was made given that there are plenty of free pins on the CPU. I'm getting a little frustrated. I could use mBeds but they're such a pain, having to use IP stacks of unknown quality written by 3rd party developers.



#18538 Crash on network socket unplug

Posted by phil on 28 September 2011 - 08:25 AM in Netduino Plus 2 (and Netduino Plus 1)

Does anyone has any idea why a Netduino plus crashes out if the network cable is removed and then plugged back in?

In simple terms, my app is:

void Main()
{
  try
  {
     while (!button pressed);

     Connect to tcp server
     send message to tcp server
     poll for response
  }
  catch (Exception)
  {
     Print error
  }
}

Now, if I stop the tcp server and press the button, no sweat - the catch triggers on the send failure and then eventually
recovers when the server is restarted.

But if I pull the network cable it bombs right out .. no exception. I know it's dead as I have a threading.timer running flashing the LED each second. It just dies when the network cable is out and I press that button... Tracing the code, it seems to die at a Socket.Connect call.

I can't see any obvious way to detect if the cable is in .. if there was a way to do that I could avoid the connect call.

This is firmware 4.1.0.6

Big problem for me. I wanted to use the netduino pluses in a production environment but if they can't survive a cable pull or switch reset, then they're no good to me.




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.