cancel
Showing results for 
Search instead for 
Did you mean: 

AzureRTOS NetxDuo HTTP Server and FileX

Davide Dalfra
Associate III

Hi Folks

I have few question about HTTP server  if someone here in the started playing with it.
As i have plenty of flash on the MCU i opted to store a simple html page directly on the mcu flash memory (like done with mkfsdata.exe on LWIP).

Streaming out the payload is not a problem however seems i can't generate the correct http headers.
For streaming out data i do :

 

 

  if ( strcmp( resource , "/jquery_3.6.0.min.js") == 0 )
  {
    size_t i = 0;
    size_t size_html = sizeof(data__jquery_3_6_0_min_js);
    size_t send_size  = 0 ;
    
    
    while ( size_html != 0)
    {
      if ( size_html < 512 )
        send_size = size_html;
      else
        send_size = 512;
      
 
      
      nx_web_http_server_callback_data_send(server_ptr, (void*)&data__jquery_3_6_0_min_js[i], send_size );
      size_html -= send_size;
      i+=send_size;
      
    }
    return(NX_WEB_HTTP_CALLBACK_COMPLETED);

 

 

I tried the approach of sending the payload by calling the _nxe_packet_data_append and then the nx_web_http_server_callback_packet_send but as the file is about 30KB it fails in allocating the nx_packet in the pool

My question then are:

  1. If i have to stream out a fragmented http response ( size to send out is more than an eth packet), do i strictly need to have a set of nx_packet (in the pool) bigger or equal to the size i have to send out? Is there any way to send out a chunk per time by iterating in a while loop? I have to stream out a jquery.min.gz (so i need to set content type and also content encoding as headaers) and the payload is about 30KB.

  2. I tried to copy the payload i have on MCU flash to the external SPI Flash running FileX+LevelX. File are created correctly and also content matches, however seems NetX/HTTP server does not see those file when requested. I debugged till the root of the request where the file is open, but then nothing happens. Any tips on that?

 

I do see in CubeMX examples that a web_server.bin file need to be loaded at a certain address, but nothing explained about how to create this web_server.bin file.

 

 

Thanks in advance

Davide

1 ACCEPTED SOLUTION

Accepted Solutions
Haithem Rahmani
ST Employee

Hi @Davide Dalfra,

Unlike LwIP, The NexDuo Web server requires a FileX file system to correctly read data and stream them.
If you need more details about how to create the web_server.bin file could you please contact me via private message.

regards
Haithem.

View solution in original post

2 REPLIES 2
Haithem Rahmani
ST Employee

Hi @Davide Dalfra,

Unlike LwIP, The NexDuo Web server requires a FileX file system to correctly read data and stream them.
If you need more details about how to create the web_server.bin file could you please contact me via private message.

regards
Haithem.

Hi, 

Done, i just sent you a PM.
Thanks in advance

 

Davide