System.Net.Sockets.SocketException occurred in Netduino.IP

Hi,
I get this exception randomly. The exception is thrown in core code on which i can not access.

How to fix this because after this exception device is not working.

Thanks

Hi

What device are you running on NP,N2P, N3W, N3E ?

Could you provide a code snippet to illustrate?

Are you doing HTTP requests, or using a library for AMQP etc.?

@KiwiBryn

Hi,
I’m using N3E and I use for communicate

               server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
               server.ReceiveTimeout = SOCKET_TIMEOUT_MILISECONDS;
               server.Bind(new IPEndPoint(IPAddress.Any, PORT));
               server.Listen(Int32.MaxValue);
               Socket clientSocket = server.Accept();
               Thread commThread = new Thread(() => ProcessRequest(clientSocket));
               commThread.Start();

I have copied all code together here. Code in my program is a little separated and surrounded with

 try
{
}
 catch(Exception)
{}
catch
 {
      //Catch non-CLSCompliant
 } 

The random crash is happened in native code and after crash none off try catch catch the exception. This bring it to dead state of my netduinos, software is running but i cannot communicate to him over socket.

In my separed app in which i have code for search this device and communication i can successfully ping device but if i make any call to here i get error response.