Go Down

Topic: Reading packet data with limited memory. (Read 388 times) previous topic - next topic

cjdelphi

When reading back either the /GET /POST (Etc) request or just simply reading up until you hit CR/LF.

What's the best way to do it?.. in windows a 20k array to store the results in, is quite easy, but if you're limited  what do you do? read as much as you can and dump the extra?.. eg, let's suppose you did something like /GET bleah bleah, and in the return you need certain values, eg maybe the content length, or maybe something else of use, or a command remotely to make it do something..


So what are the do's and dont's? for example let's suppose i had a 250 byte char array buffer, when that 250 is filled, do i go back to array[0] and start to fill it again? or do i simply accept that Arduino was never designed to be a webserver..... and you get around the limitations the best you can? 

PaulS

Look at the html page that the Arduino is sending. If it contains a form, with no text entry fields, the maximum length of the returned GET command will be fixed. You can control that length by using short names. radioButtonLeftSideWidget=turnTheLeftSideOn will take more time to receive and more memory to store and parse than rbLeft=1.

If the form contains a text entry are, limit the size of the field.

When reading, storing and parsing the return data, it is not necessary to store anything before the ?. You can store the data up to the =, then interpret that. Then store the data up to the & or end of data, and process that.

It is not necessary to read and store the whole packet before starting to parse it.

Go Up