Multithreaded Webserver and DataLogger
#1
Posted 01 March 2012 - 12:49 PM
As someone once said, "it's not ready for prime time" but I had a request from Mr EMG to upload it. So you get it early.
Here is my go at a Netduino Multithreaded Webserver and DataLogger.
I uploaded it to Codeplex.
Homelogger
It does work fine under certain conditions.
On a quiet LAN.
Me as the user.
For testing it once did 6000 page requests in 6 days via autorefresh, but since I opened the port to put it on the internet it crashes regularly.
I still have stability problem, when a user clicks the refresh button repeatedly, it will always crash.
One day if I have time I will fix it.
Another day I will put a watch dog on it. Based on a second Netduino that requests pages.
#2
Posted 01 March 2012 - 01:01 PM
#3
#4
Posted 01 March 2012 - 02:21 PM
#5
Posted 01 March 2012 - 04:29 PM
For testing it once did 6000 page requests in 6 days via autorefresh, but since I opened the port to put it on the internet it crashes regularly.
I still have stability problem, when a user clicks the refresh button repeatedly, it will always crash.
Be sure not to use the standard web port - Use like 28731 or something else random facing the Internet (you don't have to change it in he N+, just redirect in the firewall). That will keep it from being hit by most automated attack code that's going after unpatched IIS servers.
#6
Posted 09 March 2012 - 05:11 AM
Be sure not to use the standard web port - Use like 28731 or something else random facing the Internet (you don't have to change it in he N+, just redirect in the firewall). That will keep it from being hit by most automated attack code that's going after unpatched IIS servers.
I suppose 8082 is not random enough
P.s I went over to codeplex and noticed that a few people had downloaded it.
If anyone wants to fix it, change it log bugs or even be the owner of the project they are welcome.
I haven't got the time to do much right now.
I will finish it one day, for my own sake at least.
#7
Posted 15 March 2012 - 12:27 PM
#8
Posted 16 March 2012 - 08:11 AM
#9
Posted 22 June 2012 - 02:25 PM
#10
Posted 22 June 2012 - 02:43 PM
a Junior .NET/Java/Flex/Grails&Groovy developer and electronics noob from Holland
Hey! Welkom op de Netduino Forums
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#11
Posted 23 June 2012 - 01:01 PM
I'm really glad you managed to find some use for the code, hope you make something really good with your project.
I know how hard it is to use somebody elses code, so that fact that you can use code from an unfinished, poorly documented project, mean that at least my attempt to write reusable code must be partially working.
Here is my liability waiver, It was a work in progress that got stalled because I couldn't get it right, then ran out of program memory.
I didn't mean to put it out to general view until I had fixed the bugs, done the binary upload and rearranged it neatly.
4.2 RC5 should give that extra space. But I was a bit disappointed that I still have a memory leak, so maybe it is my code.
My logger is still actually running but I have to cycle power as it crashes every 10 days or so due to the memory leak. I am fairly sure it is to do with being on the Internet because it used to run for over a month before I opened my gateway for it.
I still cant finish the Webserver/Logger due to my limited amount of time, but if you want to mention any bug fixes you see in the code then go ahead.
Biggest challenge so far was getting the multithreaded hardware calls synchonised to the hardware implementations, making sure the same relays doesnt get triggered by 2 requests at the same time.
Just use a lock for Thread synchronisation. I view any hardware as a resource and therefore because you can have multiple callers on different threads one has to wait for the other to complete.
I do love the challenges of multithreaded apps, fun to debug.
You seem to be making a real webserver.For handeling the webrequest that have no mimetype and are skipped by the webservice ive created a factory(mapper) that has all the availeble implementation for the hardware in the form of handlers stored in an hashtable.
All i have now are a relay handler and a logginghandler loaded in the hashtable.
I use a switch statement to find the correct handler based on the url fragments and then invoke doWork on the handler. I provide the doWork method with a string array of urlfragments. So all the implementation logic like calls to the hardware resides in the handlers. Ive created an interface for the handlers and a baseclass for the general work.
I know I should use JSON in projects but I tend to use XML due to my familiarity.
I don't quite follow, I haven't really tried 4.1. I have tried 4.2 RC3,4 and 5 no joy for me here.psps: fixing the n+ crash when using too much requests is easy by upgrading the firmware.. theres a bug crashing the n+ with an outofmemory exception in the 4.1 firware when theres plenty of memory left
I love the language C# I just wish one day in the future we could have a Jit compiler on the Netduino.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users