AnsweredAssumed Answered

HTTPSRV_cgi_write() taking a very long time to transmit a reply to a webpage

Question asked by Tim Hutchinson on Mar 11, 2015
Latest reply on Mar 12, 2015 by soledad

Hi All,


     I'm using MQX RTCS 4.0.2 (ported into MQX on a Freescale MPC-5125 and have found it's taking an extremely long time to send a large reply message back to a webpage hosted by the built-in MQX webserver. I'm sending about a 225K message (All ascii chars) back to the webpage and the HTTPSRV_cgi_write() function is taking approximately 10 seconds to return! Here's the general idea:


_mqx_int CGI_ServiceReq(HTTPSRV_CGI_REQ_STRUCT *param)
     uint_32 lReplyLen;
     char_ptr cBuf = NULL;

     //Allocate a temp buffer
     cBuf = _mem_alloc_system(230000);

     //Load data into cBuf here....
     for(lReplyLen = 0; lReplyLen < 225,000; lReplyLen++)
          cBuf[lReplyLen] = 0x30;

     response.ses_handle = param->ses_handle;
     response.content_type = HTTPSRV_CONTENT_TYPE_PLAIN;
     response.status_code = 200; = cBuf;
     response.data_length = lReplyLen;
     response.content_length = response.data_length;



When the webpage sends a user selected binary file back to the web server, using http POST, a 2 MB file takes just a second or so. Is there some other way I should be sending replies to the webpage that contain significant amounts of data? Can the data be sent in a binary fashion and would that likely be any faster? Maybe there's an MQX buffer size issue and I would be better off breaking the message into smaller chunks (or increasing the buffer size)? I'm pretty new to working with http so I'm just doing what is displayed in the examples that Freescale provides but none of the examples was shown transferring large amounts of data. Thanks in advance for any help or suggestions.


Best Regards,