Streamlib.h crashes with 10Ko strings

Hello everyone!

I have to send a long string (>10 000 char) through my ENC28J60 with ESP8266. Streamlib.h is a great library for sending streams (link). But here it is impossible due to calculation duration, the software WDT makes a reset.

I have already put a yield() inside :

size_t BufferedPrint::write(const uint8_t *buf, size_t length)
{ 
   yield(); 
   for (size_t...

Helped a lot but did not solved. Still crashing while writting.

How can it be improved?

Thanks in advance!

PS: my code is

const size_t BUFFER_SIZE = 128;
char html_buff[BUFFER_SIZE];
BufferedPrint message(client, html_buff, sizeof(html_buff));
message.print(F(HTML_STRING));

with HTML_STRING the 10Ko string.

are you a running a web server and need to serve a large page ? have you considered chunked transfer encoding?

Replacing BufferedPrint by ChunkedPrint was indeed suffiscent.

Maybe I did not get what BufferedPrint print was doing, I thought it used a small buffer to send data, obviously that's what ChunkedPrint print is doing.

Thanks!

ChunkedPrint extends BufferedPrint and changes the output to http chunked transfer encoding. size of the chunks is the size of the provided buffer.
I don't see how it helped.

do you use lwip_enc28j60 library?

I am using EthernetENC.h. Do you think lwip_enc28j60 library could be more reliable?

In my further development I look forward HTTPS libraries, which require ESP32.

I took a look at the lwip libraries from khoih-prog. Hard to pick up the right one. I think this one should do the work, together with Streamlib to chunk streams.

use lwip_enc28j60

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.