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

Another Web Server


  • Please log in to reply
4 replies to this topic

#1 OZ8ET

OZ8ET

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts
  • LocationHundested, Denmark

Posted 17 February 2012 - 10:20 AM

This place is flooded with web server samples and here comes another one. Why? I have tried them all and got lots of very good inspiration – thank you – but I also had problems with thenm all, when implementing with other processes and increasing load. I wanted to use web pages on SD together with embedded web pages. Pages can be quite demanding, if containing lots of images, java script files and other and the typical problems I had, was Out of Memory exceptions, very slow response and lock-up. This version works for me. Try it. It has a standard request handler that deals with files on the SD, a directory browser and the build-in (embedded) default webpage. You can implement your own request handler by giving the reference to the this in the startup call for the web server. My final project is a House automation controller which includes Onewire reading of several temperature devices, temperature regulation and a control panel using Aduino LCD1602 Shield. It all works very nice, but this is about the web server part only and the source is attached for information. Have fun OZ8ET

Attached Files



#2 Magpie

Magpie

    Advanced Member

  • Members
  • PipPipPip
  • 279 posts
  • LocationAustralia (south island)

Posted 17 February 2012 - 11:42 AM

HI OZ8ET Really like your webserver, and will borrow some of your ideas/code to improve mine. Provides a terrific start for N+ users. The string parsing seems fast and much more optimised than mine. So I might borrow some of that. Also like your use of a few important extension methods, it makes the calling code a little bit more readable. I ran it in 4.2, no changes were necessary. ps. You have a couple of Typos. << and >> in a couple of places. also the in the directory view, the link urls had a back slash that needs to be removed. Good work, I'm sure others will like it too.
STEFF Shield High Powered Led Driver shield.

#3 OZ8ET

OZ8ET

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts
  • LocationHundested, Denmark

Posted 18 February 2012 - 01:06 PM

Thanks Magpie. Glad to hear it works with 4.2. I use 4.1.0.6 because of the Onewire support. Waiting for 4.2 to come out with Onewire :rolleyes:

#4 Cabadam

Cabadam

    Advanced Member

  • Members
  • PipPipPip
  • 90 posts

Posted 19 February 2012 - 02:46 PM

OZ8ET, This is great - there are definitely some things I may integrate into what I'm doing now. One small thing - sendFileBrowser sends a "Connection: Close" header, but none of the other methods (sendStream, sendFileNotFound do. Based on the implementation, I think it is definitely INTENDED to be closed after each call (HttpRequester has each client socket wrapped in a using block). I actually do have a more real concern - but it is more general to several HTTP implementations I've seen here, so I'll create another thread for that. Thanks! Edit: Created new thread - http://forums.netdui...ne-socket-read/

#5 OZ8ET

OZ8ET

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts
  • LocationHundested, Denmark

Posted 19 February 2012 - 03:23 PM

Thanks Cabadam - you are abslolutely right - there should also be a "Connection: Close\r\n" added to the other headers.




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.