I'm developping with IDE 1.0.1 and current version of TextFinder a Ethernet Stream parser. I do read only the first 100 bytes and parse the content with finder.getValue() into a object in ram.
A typicall request by current browser will be as long as 450 bytes and take arround 155ms to be read on Arduino.
Does anyone know what would happen with the (arround 300 bytes) unread data from Ethernet Shield when doing client.stop()?
Going into the libary. They wrote a myRead() with a included timeout. It allways brings the code to this timeout loop when no data is available. (if condition has no else condition). I rewrote the 5seconds to 100ms timeout in the lib. But anyway, hanging there in the loop is mess.
Can you control how many bytes are read, ie 100 in your example ?
Can you use the findUntil function instead. It seems that you can continue the search at the point where the first value was found.
@UKHeliBob: yes, arround 40 byte are read. The HTTP request by google browser starts with
GET /&dev=250&val=24\n\rConnection. ....
Im only interest having the val and dev value in my arduino-code. How do I get rid of the last 350 bytes?
@SurferTim: Thanks for the hit with the socket. It looks then one should hardly clear all the conent in rx buffer. What would be the fastest way for skipping this data? May I bring in then somethin like (what will take some time: my guess - not collected any data now: 400ms) while (client.avalible()>0) { client.read(); } or while (client.read()>0) { }.
If this is a GET request, the signal the client is finished sending is a blank line (double cr/lf). Read packets until then. Here is my server code that does just that. Maybe this code will help you. http://playground.arduino.cc/Code/WebServerST
Thanks for this. I was surprise. This code in your link is different than in the download libary ZIP-file.
They just went throught the full request string with while(client.available()) and char c = client.read(); Hence, there's none command to get rid of the nonreaded rx-buffer data corresponding to the client object opened?
I can't vouch for anyone's code but mine. When I started using the ethernet shield, I couldn't get any example web code to work for any length of time. Mine has been tested and is very reliable.
edit: It was worse than that, actually. I couldn't get the ethernet shield to work at all. It required modifications to the libraries to prevent it from locking up. http://arduino.cc/forum/index.php/topic,68785.0.html
Thanks for this hint: I was looking in the post and found your entry on nongnu.org with the missing entry in delay.h with "#include <math.h>". I'm not sure if you reference to this entry? The complailer doesn't report any error in my IDE 1.0.1 (no idea from here what avr version is laying down).
I couldn't get working the TextFinder .getValue() function for this evening. Hence, I tried to use the SurferTim's code. I cannot get working the (client) at all. Beside, is there any tutorial about atoi and