http_client event handler

zliudr
Posts: 142
Joined: Thu Oct 03, 2019 5:15 am

http_client event handler

Postby zliudr » Tue Apr 07, 2020 5:31 am

I'm writing a file downloader routine where I have the http client event handler save downloaded file to a RAM buffer. When that is full, I write it to sd card, start from the beginning of the buffer to fill it again until their is no more data.
So the HTTP_EVENT_ON_DATA handler reads and dumps data to buffer and file. The HTTP_EVENT_ON_FINISH handler writes the last bits of data and closes the file.

What I wonder is whether the above flow is good. Also if I'm writing to sd card file in the handler, will I lose any incoming data or is there an underlying mechanism that tells the server to wait until the event handler exits? I know that if I reduce the memory buffer size, then each sd card write will be short and less likely to affect receiving but I really wish to know whether receiving side will lose data if I spend longer time with sd card writing.

Thank you!

Who is online

Users browsing this forum: No registered users and 16 guests