String vs string

wildbill:
Fragmentation can occur when you're using dynamic memory allocation and then releasing it. String objects use memory allocation all the time. You can allocate memory to put C strings in, but you don't have to. They may be global or exist ephemerally on the stack.

Since String operations involve behind the scenes allocations, it's easy to write code that makes Swiss cheese of your heap without realizing it. If you want to achieve the same disaster with C strings, you have to be explicit about it.

String objects have their place, but in my view, that place is far away from an Arduino with limited RAM.

As to saving wifi results, try not to. Parse what you need as you receive it if possible. If it isn't, define a properly sized static buffer and check that you don't exceed its limits.

Thank you. So using strings it is just more obvious, when I fragmentate my memory. But both, strings and Strings, are capable of doing so.

aarg:
Why do you need to save the response at all? Usually you can just send the data consecutively and it will be recognized at the receiving end, once the delimiting symbols have been seen. That general principle applies both to serial and http connections. Often, programmers falsely believe that the entire message must be concatenated and sent in one big block, that is not the case.

On which device are you sending, and which one receiving? Are you assembling a received message, or assembling a message for transmission?

I use an ESP8266 with the ESP8266Wifi and ESP8266WebServer libaries. But if I think about it, you are right. I actually don't need to save the whole response.