Hello,
I have a website on LwIP with list of files with possibility to download them. I'm using function:

#define BUFFER_OUT                16000
static BYTE archDownBuffer[BUFFER_OUT] __attribute__ ((section(".sdram")));
char archive_page[WEBSITE_BUFFER] __attribute__ ((section(".sdram")));
static BYTE respond[110];
UINT archDownCounter, sentCounter;
FIL arch_file;

/void archive_download(struct netconn *conn, const char* filepath)//
//{//
//
//    FRESULT res;//
//    archDownCounter = 0;//
//    sentCounter = 0;//
//    size_t written;//
//    int cx;//
//    err_t test;//
//    res = f_open(&arch_file, filepath, FA_READ);

////    if (res == FR_OK)//
//    {//
//        cx =//
//                snprintf(archDownBuffer, BUFFER_OUT,//
// "HTTP/1.1 200 OK \r\nContent-Type: file/csv\r\nContent-Length: %lu\r\n\r\n",//
//                        arch_file.fsize);

//// netconn_write(conn, (const char* )(archDownBuffer), (size_t )cx, NETCONN_NOCOPY);

////        for (;;)//
//        {//
// res = f_read(&arch_file, archDownBuffer, sizeof archDownBuffer, &archDownCounter); /* Read a chunk of source file *///
//            if (res || archDownCounter == 0)//
//                break; /* error or eof *///
// test = netconn_write_partly(conn, (const char*) (archDownBuffer), (size_t) archDownCounter, NETCONN_NOCOPY,//&written);

////            if (test != ERR_OK)//break; /* error or disk full *///
//            if (written != archDownCounter)//break;

////            vTaskDelay(40); //time for other tasks//
//        }//
////
//        f_close(&arch_file);//
//    }//
//}

/to send them to a browser but after a couple of iterations the loop and whole stack freezes and LwIP stops working. With really small vTaskDelay and large BUFFER_OUT there is possibility of Hard Fault pointing to lwip_netconn_do_writemore.

Is there any better method to send large files by netconn?

Regards,
Michal Golebiowski
_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to