uHTTP library function uHTTP::body(); didnt return complete data

Hi.

I'm trying to use the uHTTP library for receive client http request.

most of it work well except on a put request i'm receiving a big JSON data. I want to use arduinoJSON to parse it, so I get in my skecth function. server->body()

but when I monitor it, i only get a small part of the data, even it I put very big theuHTTP_BODY_SIZE (my data approximately 1500 char, tried the buffer until 5000...)

if I print the client data, all the data is present, so I don't know from were the bug could came from.

if I print the client data, all the data is present, so I don't know from were the bug could came from.

If you read and print the data one character at a time, you use exactly one byte of SRAM. If you try to store all the data, you use a lot more SRAM - probably more than you actually have.

I using arduino DUE with 96kB.. seem ok... me data have 1500 char...

also i'm able to post to client the same data string without trouble...

I using arduino DUE with 96kB…

and invisible code. Good luck.

ok will try to short up the string... and free up some memory... BTW, is scheduler consume a lot of sram?

BTW, is scheduler consume a lot of sram?

How are we supposed to know? You haven’t posted any code or any links to the libraries you are using.

the code in attachment… but it is a big bunch…

demo_webserv10.ino.ino (19.8 KB)

  inChannels ( char* name, int pin, bool switchCh, float offset) { //setup temp input
    strcpy(name, channelName);

Copy the data that channelName points to (it does NOT point to anything) over the input argument. How useful is THAT?

You can't make channelName point to anything, because it is const, so you can never change its value.

I quit reading at that point. Your entire program is based on the struct that is garbage.

Yes PaulS. That's was an artefact of something I've tried to fix before. change it to a classic String. I don't fully understand yet pointer so I try to avoid it, but some bug append using some library... try to find my way over it.. :P

but thanks for your help. It is probably , like you said before that I overloaded the sram, so I decide to short the data I will receive instead.

Is there a tool or a simple way co calculate the use of sram ?

like you said before that I overloaded the sram

On a Due, that seems unlikely. But that struct is nonsense. And, since it is the root of your program, it MUST be fixed.

You MIGHT have meant:

strcpy(channelName, name);

which would copy the data in the right direction, but channelName doesn't point to memory where you can write.

You COULD have used: channelName = strdup(name); which would have allocated memory for the copy of name and made channelName point to that memory.

Of course, that wouldn't work because channelName is a const pointer and can't be pointed at some other memory location.

Of course, you could loose the const declaration...