Thank you for making this available. I've been working on it for my Spinneret project. I added an LED button and have been happily toggling the LED on/off a bit this afternoon. Since the LED is yellow when on I made the button that way too. I have it publicaly available on github https://github.com/jhalbrecht/nerdDoro
The numbers were just a note for me to keep track of an offset during the dynamic html updating that the spinneret perfromed. If you look higer in the code...
If P24 == 0
bytemove(@buttons[86+70*0],@RED,5)
Else
bytemove(@buttons[86+70*0],@GREEN,5)
If P25 == 0
bytemove(@buttons[86+70*1],@RED,5)
Else
bytemove(@buttons[86+70*1],@GREEN,5)
If P26 == 0
bytemove(@buttons[86+70*2],@RED,5)
Else
bytemove(@buttons[86+70*2],@GREEN,5)
If P27 == 0
bytemove(@buttons[86+70*3],@RED,5)
Else
bytemove(@buttons[86+70*3],@GREEN,5)
The number 86, is the number of bytes from the buttons address before the first "R" of the word RED in the HTML code. Where it says 64 in the HTML code it should actually say 70. This is the amount of offset in BYTES from the first "R" in RED to the first "R" in RED on the next line down. ... It was 64, because the HTML code said something slightly different when I originally wrote it.
Hi, I wonder if there ever was a solution found on the crash-problem issue, (described first time in this thread at post #19). I do have a Spinneret setup based on Beau's code but with even a more simple html-page then in his originally "Spinneret_Web_Server_DEMO v1.2". Just a few html-tags and one single variable that increases for each hit. All the secondary objects are in their original version.
My spinneret is connected around the clock and LEDs are always blinking. After start up I can usually access the Spinneret for a few hours but never until next morning. Not from outside and not through my internal network. A friend of mine also face the same problem with his Spinneret using the same spin-files. The browser keeps trying to connect but it ends with a timeout. I keep the Spinneret at port 5000 and you can reach it (if I just reset) at la3usa.com:5000
I can't remember this was a problem when testing Mike's serverbeer-code so I guess there is a bug somewhere in one of the secondary objects in Beau's project.
I'd have to look at your source code to be sure... The lockups we saw early in Spinneret development were related to, I believe, managing socket state. You must check the socket status as the socket goes through each phase from open to close (see the manual). If the socket gets stuck in CloseWait then then a disconnect, close, and open must be issued.
Another issue was related to concurrency. One socket has trouble responding to more than one concurrent request. If a single socket is bombarded with many requests the socket can end up in an unexpected state. So again, you must monitor socket state and execute appropriate logic.
I've had a Spinneret running HttpServer for well over a year without a lockup.
Hi Mike, I attached my sourcecode if you would like to take a look. The html is taken from a running PINK and contains some dead Nb_vars. I can't imagine that there is a concurrency problem, the spinneret has not faced much requests other then from myself. But there is a chance that could be a problem once the project is finished and the spinneret is permanently online.
When I used your testcode the spinneret never got stuck but it does with this code.
My problem is I am too much of a newbee on this Wiznet-stuff so I really need some advices here to be able to really understand how things works.
Moskog, the follwoing line of code can be a problem.
repeat while !W5100.SocketTCPestablished(0)
This code assumes the socket is in a particular state but the state is not checked. If the socket is Closed or CloseWait the repeat will loop forever.
I wrote a new driver and libraries for the Spinneret. The Html5Graph is more like what you are doing; no SD card or RTC interface. The WebServer_W5100.spin is a basic web server with SD and RTC support.
Ok, thanks.
The html5graph looks very interesting. I suppose my own setting like subnetmask, ip, mac and gateway should be set by replacing the empty numbers in the DAT section of W5100 object, right?
But where do I set my port number (e.g. 5000)?
And do I then call the spinneret with the browser by typing 10.0.0.190:5000/index.htm?
Html5Graph uses DHCP so just watch the PST screen for the assigned IP. You can request a specific IP by invoking the dhcp.SetRequestIp(192, 168, 1, 110). However, the IP must be available otherwise DHCP will assign the IP.
Ok, now it seems like it works.
The strange thing is that even though I tried to give it the original IP number 10.0.0.190 it kept renumber it to 10.0.0.186.
So the next thing to try was to set the IP to 10.0.0.186 and also replace the Virtual server configuration in the router with the same number (for the outside access) and that also worked. At least for tonight.
You say it will try to find another IP in case the original number is not available, I wonder why the Spinneret's original IP wasn't available no more, all the other devices on my network has fixed IP numbers, it should still be available.
But 10.0.0.186 is good enough as long as it does not change it.
Spinneret should now be seen at la3usa.com:5000
Thanks again, I really do appreciate your help!
Edit: Well, ten minutes later the IP address has changed again, now it is 10.0.0.187
Any idea on this new dynamic IP address issue?
I used this snippet to manually set the IP and other addresses. I have two spinnerets, one for testing and one that's deployed in the chicken coop. I just select the one I need and comment out the other. Don't know if you'll need that, so just ignore the extra set of Mac and IP commands.
wiz.HardReset(RESET_PIN)
{ ======================= select deployed or test spinneret ============================== }
'deployed spinneret
' wiz.SetMac($00, $08, $DC, $16, $F3, $25)
' wiz.SetIp($61, $0A, $0B, $FE) 'deployed unit
'97.10.11.254
'test spinneret
wiz.SetMac($00, $08, $DC, $16, $F2, $1A) 'test unit
wiz.SetIp($61, $0A, $0B, $FD) '97.10.11.253
'dont forget to adjust GetValues Method
'common to both units
wiz.SetGateway($61, $0A, $0B, $01)
wiz.SetSubnetMask($FF, $FF, $FF, $00)
wiz.CopyDNS(@dns_addr, 4)
{===========================================================================================}
Then comment out the DHCP code:
pst.str(string("Getting network paramters", CR))
{
-- comment out or delete --
dhcp.Init(@buff, DHCP_SOCKET)
pst.str(string("Requesting IP....."))
repeat until dhcp.DoDhcp(false)
if(++i > DHCP_ATTEMPTS)
quit
if(dhcp.GetErrorCode > 0 OR i > DHCP_ATTEMPTS)
pst.char(CR)
pst.str(string(CR, "DHCP Attempts: "))
pst.dec(i)
pst.str(string(CR, "Error Code: "))
pst.dec(dhcp.GetErrorCode)
pst.char(CR)
pst.str(dhcp.GetErrorMessage)
pst.char(CR)
return
else
}
PrintIp(wiz.GetIp)
OK, I'm back on the track again and the Spinneret is up and running with its origial, static IP number. I loaded in the PINK html-file for testing, with empty values so far, but now I think I have something to continue from.
Comments
get it's own IP address for Dynamic DNS Services?
Most routers support it, but it would be also good to have the spinneret doing it directly for itself.
http://www.no-ip.com/services/managed_dns/free_dynamic_dns.html
http://www.dyndns.com/services/dns/dyndns/domains.html
The protocol on how do it:
http://www.no-ip.com/integrate/
Thank you for making this available. I've been working on it for my Spinneret project. I added an LED button and have been happily toggling the LED on/off a bit this afternoon. Since the LED is yellow when on I made the button that way too. I have it publicaly available on github https://github.com/jhalbrecht/nerdDoro
What are the numbers in the {comments] used for?
The numbers were just a note for me to keep track of an offset during the dynamic html updating that the spinneret perfromed. If you look higer in the code...
The number 86, is the number of bytes from the buttons address before the first "R" of the word RED in the HTML code. Where it says 64 in the HTML code it should actually say 70. This is the amount of offset in BYTES from the first "R" in RED to the first "R" in RED on the next line down. ... It was 64, because the HTML code said something slightly different when I originally wrote it.
My spinneret is connected around the clock and LEDs are always blinking. After start up I can usually access the Spinneret for a few hours but never until next morning. Not from outside and not through my internal network. A friend of mine also face the same problem with his Spinneret using the same spin-files. The browser keeps trying to connect but it ends with a timeout. I keep the Spinneret at port 5000 and you can reach it (if I just reset) at la3usa.com:5000
I can't remember this was a problem when testing Mike's serverbeer-code so I guess there is a bug somewhere in one of the secondary objects in Beau's project.
Another issue was related to concurrency. One socket has trouble responding to more than one concurrent request. If a single socket is bombarded with many requests the socket can end up in an unexpected state. So again, you must monitor socket state and execute appropriate logic.
I've had a Spinneret running HttpServer for well over a year without a lockup.
When I used your testcode the spinneret never got stuck but it does with this code.
My problem is I am too much of a newbee on this Wiznet-stuff so I really need some advices here to be able to really understand how things works.
This code assumes the socket is in a particular state but the state is not checked. If the socket is Closed or CloseWait the repeat will loop forever.
I wrote a new driver and libraries for the Spinneret. The Html5Graph is more like what you are doing; no SD card or RTC interface. The WebServer_W5100.spin is a basic web server with SD and RTC support.
The html5graph looks very interesting. I suppose my own setting like subnetmask, ip, mac and gateway should be set by replacing the empty numbers in the DAT section of W5100 object, right?
But where do I set my port number (e.g. 5000)?
And do I then call the spinneret with the browser by typing 10.0.0.190:5000/index.htm?
Example:
The strange thing is that even though I tried to give it the original IP number 10.0.0.190 it kept renumber it to 10.0.0.186.
So the next thing to try was to set the IP to 10.0.0.186 and also replace the Virtual server configuration in the router with the same number (for the outside access) and that also worked. At least for tonight.
You say it will try to find another IP in case the original number is not available, I wonder why the Spinneret's original IP wasn't available no more, all the other devices on my network has fixed IP numbers, it should still be available.
But 10.0.0.186 is good enough as long as it does not change it.
Spinneret should now be seen at la3usa.com:5000
Thanks again, I really do appreciate your help!
Edit: Well, ten minutes later the IP address has changed again, now it is 10.0.0.187
Any idea on this new dynamic IP address issue?
I used this snippet to manually set the IP and other addresses. I have two spinnerets, one for testing and one that's deployed in the chicken coop. I just select the one I need and comment out the other. Don't know if you'll need that, so just ignore the extra set of Mac and IP commands.
Then comment out the DHCP code:
Then change this: to this:
Beside of that, I checked your Doc's Flock- project earlier and that looks awesome!
Thanks again, Mike G and Doggidoc!
http://la3usa.com:5000/