AnsweredAssumed Answered

HTTP server stuck in function httpsrv_read()  when receiving large data

Question asked by Julie Song on Aug 4, 2015
Latest reply on Aug 10, 2015 by Martin Latal

I have a CW10.6 and MQX4.2 project which runs on K60F120M. I found that when large data(the size is greater than HTTPSRVCFG_RX_BUFFER_SIZE) is uploaded to the HTTP server, sometimes the server is stuck in httpsrv_read() function (in httpsrv_supp.c), the call to httpsrv_recv() returns 0 while (read<len), so the function is stuck forever while waiting for more data.

Here is the code snippet of httpsrv_read:


    /* If there is some space remaining in user buffer try to read from socket */
    while (read < len)
        uint32_t received;

        received = httpsrv_recv(session, dst+read, len-read, 0);
        if ((uint32_t)RTCS_ERROR != received)
            read += received;


Before digging deeper into the RTCS code, I'd like to know if anybody else had the same problem? And if yes, how to solve it?

Thank you very much for your help,