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

Netduino Plus webserver Help


  • Please log in to reply
3 replies to this topic

#1 gordon128

gordon128

    New Member

  • Members
  • Pip
  • 9 posts

Posted 28 May 2011 - 08:40 PM

Hello fellow N+'s Code taken from: http://www.schuurmans.cc/tag/webserver I’ve use the code to do with this article and it does the job I’m looking for. How ever, I send a request to the server and all works OK. When I go to send another request a little later, it is as though the server has frozen. The only thing I can do is to re-boot the Netduino Plus. Below are the debug reports: ===========debug report=========== #### Exception System.NullReferenceException – CLR_E_NULL_REFERENCE (5) #### #### Message: #### Blinq.Netduino.Web.WebServer::InterpretRequest [IP: 0007] #### #### Blinq.Netduino.Web.WebServer::StartServer [IP: 0059] #### A first chance exception of type ‘System.NullReferenceException’ occurred in Blinq.Netduino.dll An unhandled exception of type ‘System.NullReferenceException’ occurred in Blinq.Netduino.dll ===========webserver.cs highlighted lines below=========== // Remove GET + Space string commandData = rawData.Substring(5, rawData.Length – 5); // Convert to string, will include HTTP headers. string rawData = new string(Encoding.UTF8.GetChars(bytes)); WebCommand command = InterpretRequest(rawData); Code taken from: http://www.schuurmans.cc/tag/webserver Please can anyone help on this matter. Regards Gordon

#2 Veetrik

Veetrik

    Member

  • Members
  • PipPip
  • 12 posts

Posted 29 May 2011 - 01:16 PM

It could be that rawData length is less then 5, you can try replacing: string commandData = rawData.Substring(5, rawData.Length – 5); with: string commandData = (rawData.Lenght >= 5) rawData.Substring(5, rawData.Length – 5) ? ""; However, the real issue is why is the rawData length is less than 5?

#3 gordon128

gordon128

    New Member

  • Members
  • Pip
  • 9 posts

Posted 04 June 2011 - 11:41 AM

It could be that rawData length is less then 5, you can try replacing:
string commandData = rawData.Substring(5, rawData.Length – 5);
with:
string commandData = (rawData.Lenght >= 5) rawData.Substring(5, rawData.Length – 5) ? "";

However, the real issue is why is the rawData length is less than 5?



Veetrik,

Thanks for your reply. I tried what you suggested, but the assembler didn't like the code.
After some investigation I found my problem in the program.cs.
There was no trap for a bad command sent from the browser.

Thanks again Gordon

#4 Veetrik

Veetrik

    Member

  • Members
  • PipPip
  • 12 posts

Posted 10 June 2011 - 03:35 AM

Veetrik,

Thanks for your reply. I tried what you suggested, but the assembler didn't like the code.
After some investigation I found my problem in the program.cs.
There was no trap for a bad command sent from the browser.

Thanks again Gordon


That's great Gordan. by the way the could I sent you should have been:

string commandData = (rawData.Lenght >= 5) ? rawData.Substring(5, rawData.Length – 5) : "";





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.