- Netduino Forums
- → R.Ganesh's Content
R.Ganesh's Content
There have been 12 items by R.Ganesh (Search limited from 26-April 23)
#27159 HttpListener does not respond
Posted by R.Ganesh on 13 April 2012 - 03:43 PM in General Discussion
#24920 HttpListener does not respond
Posted by R.Ganesh on 01 March 2012 - 06:20 PM in General Discussion
I have a web server running on an Netduino plus using the HttpListener listening for client requests and responding with a simple html. I am investigating a problem at a project installation, where the web server stops responding after few days of working (client requests are not so often, once in a day or even longer). I tried to reproduce the problem but did not succeed. However, during testing I noticed that one way to make the web server non-responsive is to send a burst of requests - i did this by keeping F5 key pressed in the internet explorer (continously refereshes). After this, the web server stops responding. First, the code (simplified):
internal static void RunServer() { HttpListener listener = new HttpListener("http", -1); listener.Start(); while (true) { try { Debug.Print("Listening.."); HttpListenerContext context = null; context = listener.GetContext(); Debug.Print("Received request from " + context.Request.UserHostAddress.ToString()); context.Response.ContentType = "text/html"; string html = "<html><p>Hello World " + DateTime.Now.ToString() + "</p></html>"; System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); byte[] messageBody = encoding.GetBytes(html); context.Response.OutputStream.Write(messageBody, 0, messageBody.Length); if (context.Response != null) context.Response.Close(); } catch (Exception e) { Debug.Print("Exception occured! " + e.Message); PowerState.RebootDevice(true, 1000); } } }Next, the version information:
.NetMF v4.1.2821.0
NetduinoPlus, Build Date:Mar 26 2011 02:15:31
ARM Compiler version 400902
TinyCLR (Build 4.1.2821.0)
Finally, the exception (as seen on MF Deploy console)
Listening..
#### Exception System.Net.Sockets.SocketException - CLR_E_FAIL (5) ####
#### Message:
#### Microsoft.SPOT.Net.SocketNative::accept [IP: 0000] ####
#### System.Net.Sockets.Socket::Accept [IP: 001c] ####
#### System.Net.HttpListener::AcceptThreadFunc [IP: 0020] ####
#### SocketException ErrorCode = 10056
Received request from 4.0.0.0
#### Exception System.Net.Sockets.SocketException - CLR_E_FAIL (4) ####
#### Message:
#### Microsoft.SPOT.Net.SocketNative::send [IP: 0000] ####
#### System.Net.Sockets.Socket::Send [IP: 0018] ####
#### System.Net.Sockets.NetworkStream::Write [IP: 0051] ####
#### System.Net.OutputNetworkStreamWrapper::Write [IP: 0017] ####
#### System.Net.HttpListenerResponse::SendHeaders [IP: 0021] ####
#### System.Net.OutputNetworkStreamWrapper::Write [IP: 000d] ####
#### NetduinoTest.WebServer::RunServer [IP: 0074] ####
#### SocketException ErrorCode = 10056
Exception occured! Exception was thrown: System.Net.Sockets.SocketException
Any pointers on this would be really helpful to me! Thank you!
Ganesh
#16140 RFM12B Wireless module with Netduino Plus
Posted by R.Ganesh on 01 August 2011 - 07:02 AM in Netduino Plus 2 (and Netduino Plus 1)
#14631 RFM12B Wireless module with Netduino Plus
Posted by R.Ganesh on 23 June 2011 - 01:12 PM in Netduino Plus 2 (and Netduino Plus 1)
#12898 RFM12B Wireless module with Netduino Plus
Posted by R.Ganesh on 06 May 2011 - 02:32 PM in Netduino Plus 2 (and Netduino Plus 1)
Attached Files
- RFM12B_Lib.zip 3.13KB 147 downloads
#12738 Energy meter
Posted by R.Ganesh on 01 May 2011 - 07:04 PM in Netduino 2 (and Netduino 1)
Attached Files
- Metrology.cs 8.33KB 47 downloads
#12720 RFM12B Wireless module with Netduino Plus
Posted by R.Ganesh on 01 May 2011 - 07:20 AM in Netduino Plus 2 (and Netduino Plus 1)
#12663 RFM12B Wireless module with Netduino Plus
Posted by R.Ganesh on 30 April 2011 - 06:51 AM in Netduino Plus 2 (and Netduino Plus 1)
The problem was in the receive routine - and all because of some string operation for debug message.
for (int i = 0; i < 16; i++)
{
data[i] = (byte)RF12_RECV();
//dbg += data[i].ToString() + " ";
ChkSum += data[i];
}
The line dbg += data[i].ToString() + " "; takes 1.35 ms to execute!! This delays clearing up of the fifo buffer and gets overwritten by the next transmit.
Now need to look into why string operation takes such a long time. Any ideas here..?
Cheers
#12610 RFM12B Wireless module with Netduino Plus
Posted by R.Ganesh on 28 April 2011 - 07:21 PM in Netduino Plus 2 (and Netduino Plus 1)
#12521 RFM12B Wireless module with Netduino Plus
Posted by R.Ganesh on 27 April 2011 - 05:55 AM in Netduino Plus 2 (and Netduino Plus 1)
#12503 RFM12B Wireless module with Netduino Plus
Posted by R.Ganesh on 26 April 2011 - 04:56 PM in Netduino Plus 2 (and Netduino Plus 1)
Attached Files
- RFM12B_Lib.zip 2.91KB 93 downloads
#12494 RFM12B Wireless module with Netduino Plus
Posted by R.Ganesh on 26 April 2011 - 08:12 AM in Netduino Plus 2 (and Netduino Plus 1)
- Netduino Forums
- → R.Ganesh's Content
- Privacy Policy