Pages: 1 2 3 [4] 5 6 7   Go Down
Author Topic: Introducing the Webduino web server library  (Read 21205 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 37
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I eventually got around to testing the Opera browser again, the code does not appear to recognize that there are any parameters submitted at all. With your debug switch on the exchange for Firefox (which works beautifully) is:

POST /bs HTTP/1.1<CR><LF>
Host: 192.168.42.220<CR><LF>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2<CR><LF>
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8<CR><LF>
Accept-Language: en-us,en;q=0.5<CR><LF>
Accept-Encoding: gzip,deflate<CR><LF>
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7<CR><LF>
Keep-Alive: 300<CR><LF>
Connection: keep-alive<CR><LF>
Referer: http://192.168.42.220/bs<CR><LF>
Content-Type: application/x-www-form-urlencoded<CR><LF>
Content-Length: 44<CR><LF>
<CR><LF>
password=&Puter=-&Action=-&PickleIt=PickleItGET /bs HTTP/1.1<CR><LF>
 (I've lopped off the rest of the GET._

Opera looks like:
POST /bs HTTP/1.1<CR><LF>
User-Agent: HTC_Touch_Diamond2_T5353 Opera/9.50 (Windows NT 5.1; U; en)<CR><LF>
Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1<CR><LF>
Accept-Language: en-GB,en;q=0.9<CR><LF>
Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1<CR><LF>
Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0<CR><LF>
Referer: http://autsys.co.uk:3501/bs<CR><LF>
Content-Length: 44<CR><LF>
Content-Type: application/x-www-form-urlencoded<CR><LF>
Host: autsys.co.uk:3501<CR><LF>
Cache-Control: max-age=43200<CR><LF>
Connection: keep-alive<CR><LF>
<CR><LF>
password=&Puter=-&Action=-&PickleIt=PickleItGET /bs HTTP/1.1<CR><LF>

I can work around this, but thought you might like to see the difference.

Logged

Brooklyn, NY
Offline Offline
Jr. Member
**
Karma: 0
Posts: 92
Webduino / RGB LED Shield
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Try using "#define WEBDUINO_SERIAL_DEBUGGING 2".  That will add additional output showing what stage of stream parsing the code is in.

In both cases, the code is issuing the redirect, so it's not hanging in parsing the text.  That's good news.

Try adding some serial output of your own from parsing the parameters too.

I think it may be that Opera has cached the first page so it just redisplays it.  Try adding to the httpSuccess call the extraHeaders parameter of "Pragma: no-cache\r\nCache-Control: no-cache\r\n" to tell the browser to not try to cache any data.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 37
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is the trace:

*** checking request ***
POST /bs *** requestType = 3, request = "
/bs" ***
HTTP/1.1<CR><LF>
User-Agent: HTC_Touch_Diamond2_T5353 Opera/9.50 (Windows NT 5.1; U; en)<CR><LF>
Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1<CR><LF>
Accept-Language: en-GB,en;q=0.9<CR><LF>
Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1<CR><LF>
Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0<CR><LF>
Referer: http://autsys.co.uk:3501/bs<CR><LF>
Content-Length: 44<CR>
*** got Content-Length of 44 ***<LF>
Content-Type: application/x-www-form-urlencoded<CR><LF>
Host: autsys.co.uk:3501<CR><LF>
Cache-Control: max-age=43200<CR><LF>
Connection: keep-alive<CR><LF>
<CR><LF>
*** headers complete ***

*** End of content, terminating connection

<p> - 0.</p>

*** stopping connection ***
*** checking request ***
GET /bs *** requestType = 1, request = "
/bs" ***
HTTP/1.1<CR><LF>
User-Agent: HTC_Touch_Diamond2_T5353 Opera/9.50 (Windows NT 5.1; U; en)<CR><LF>
Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1<CR><LF>
Accept-Language: en-GB,en;q=0.9<CR><LF>
Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1<CR><LF>
Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0<CR><LF>
Referer: http://autsys.co.uk:3501/bs<CR><LF>
Host: autsys.co.uk:3501<CR><LF>
Cache-Control: max-age=43200<CR><LF>
Connection: keep-alive<CR><LF>
<CR><LF>
*** headers complete ***
*** stopping connection ***

The bit in meddle is where the parameters should be printed out, 0 is the result from the server.readPOSTparam(name, 16, value, 16);

From a functioning browser you get:

*** headers complete ***
password=&<p>password - 1.</p>Puter=-&<p>Puter - -1.</p>Action=-&<p>Action - -1.</p>PickleIt=PickleIt
*** End of content, terminating connection

instead

Hope that's interesting.

Glyn
Logged

Brooklyn, NY
Offline Offline
Jr. Member
**
Karma: 0
Posts: 92
Webduino / RGB LED Shield
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It is interesting, but I'm not sure what it means just yet.  With Opera, it just fails to read any parameters at all, and from your log, it looks like it's not dumping anything from the reads.

I see it getting 44 for the contentLength and it sees the double CRLF that signals the end of the headers.  This all points to some other issue, maybe at the TCP/IP stack level, with how it determines end of connection.

I've got a WinMo device here, I'll stick my test device on my router and try some debugging using both Pocket IE and Opera.  It's always nice to learn more about HTTP variations.  Are you connecting over WiFi or the cell network?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 37
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks, since I am not fluent with C,C++ I was worried I may just be being dumb. That's also why I have not had the preumption to try and debug your code.

For that test it was over the cell network. I'll try WiFi at some point. I did try it at my other location and there was no differnce.

Yup, with the right length the only thing that struck me was that the length was not the last line of the header.

I'm local to the H/W for some days, if there is anything I can do to help just ask.

BTW can you recommend a more exhaustive intro to C++ classes than the playground offers? I've got the programming experience - but not with said language.

Y'all have fugn.
Glyn
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ben ,great work with the Webduino library.
I like to connect webduino to a local LAN.
Where I modify the  gateway and netmask settings?
I'm using the module WIZnet 810 and Arduino with ATmega168.
Thanks for the help. (sorry my english) smiley

Kcho
Logged

Brooklyn, NY
Offline Offline
Jr. Member
**
Karma: 0
Posts: 92
Webduino / RGB LED Shield
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

In the sample sketches, there's a line like the one at http://code.google.com/p/webduino/source/browse/trunk/examples/Web_HelloWorld/Web_HelloWorld.pde#49 which goes Ethernet.begin(mac, ip);  To modify the gateway and netmask settings, just add them to the line as described at http://arduino.cc/en/Reference/EthernetBegin.  The Webduino code relies on the Ethernet being setup before you call webserver.begin().



Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

working !!! ,thank you Ben .

Regards
kcho
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks, for all your help - I've certainly learned loads in the process!

john

http://www.dailymotion.com/user/NelsondissuadeMb/video/xaet2u_step-by-step-how-to-download-free-m_shortfilms download movies
Logged

Brooklyn, NY
Offline Offline
Jr. Member
**
Karma: 0
Posts: 92
Webduino / RGB LED Shield
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

There's a new 1.4 version of WebDuino on the Google Code site.  One user found a problem with multiple simultaneous connections.  It ends up that the code was writing to the Server object, not the Client object.  This caused data to get send to connections that were waiting to start, instead of having them properly hold on until the current server request ended.

I also added a timeout to the read() call here to prevent hanging the server forever if you've got a client that stops sending data.  I was able to test this by running two loops of curl calls.  If I paused one mid-connection, the other side would recover after a second of pause.

Get this from http://webduino.googlecode.com
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 37
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Could I beg a stupid bit of help from one of you.

In the Web_Buzzer example the default command is called with a pointer to the object.

I want to call a function from inside the default command function passing the object as one parameter. The C syntax for pointer et al keeps slipping past my poor old brain, can some offer an example of the function header and how to call it?

Or perhaps is there some operator overloading needed in WebDuino?

Sorry for the klutzy question, but I'm stymied.

Glyn
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 37
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Please excuse me, but minutes after asking I recalled that functions must be declared before they are used if you don't add a prototype.

So ignore me...
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

one odd thing. I started using webduino, and at first webedemo did not work. It showed analog input values, and digital IO. But I could not change state of output. Also same with buzzer demo, no pwm on pin 3. But then I just tried to add #define WEBDUINO_SERIAL_DEBUGGING 2 on start to check, and I added also Serial.begin(9600) on setup part, then all started to work! So what is the cause of this behaviour. I have webduino 1.4
Logged

Brooklyn, NY
Offline Offline
Jr. Member
**
Karma: 0
Posts: 92
Webduino / RGB LED Shield
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The demo code sets pins 0-8 to be output and pin 9 to be input, so I'm not sure why they'd act different.  The serial init should only affect pins D0 and D1, but maybe it also modifies other pin statuses.

I've never had the buzzer demo fail to run on my own boards, so again, unsure of what's happening.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok, I continue to check some ideas, and report, if I find something.
Logged

Pages: 1 2 3 [4] 5 6 7   Go Up
Jump to: