LwIP 2.1.2 and receive big file

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

LwIP 2.1.2 and receive big file

Rustam Mustafin
Good afternoon!

I am using LwIP (2.1.2) and FreeRTOS (10.3.1). LwIP in socket mode. Now I use the tcp / ip stack to create a web server. I encountered strange behavior when requesting files (pictures) from the device. On my local machine (192.168.127.2), I use wget to download files from the device (192.168.127.1). If a 505 byte icon is requested, the device sends the file normally. At the end, I see a FIN send from the device and a FIN response from the client. When I request a picture of 56 728 bytes, I see that the device has completely sent the file, but the connection is not closed. The wget utility shows that the connection is open and the file is still downloading. Although it has already downloaded (checked with binary comparison). In the case of using a browser, the pages from the device are simply not displayed, since the files hang during the transfer.

What could be the reason for this behavior? Perhaps something needs to be changed in the configuration parameters? Tried reducing the LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT timeouts, however the connection still won't close. (I looked at Wireshark).

// Implementation pseudocode:
void WebClientTask (void * p)
{
// recv (clientSock, buf1)
// find file
// write (clientSock, buf2)

// close connection
lwip_shutdown (clientSock, SHUT_RDWR);
lwip_close (clientSock);

// delete task
}

void WebServerTask (void * p)
{
// server socket
// listen
while (1) {
cl = accept
createNewTaskForClient (cl)
}
}

_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel

lwipopts.h (10K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: LwIP 2.1.2 and receive big file

Stian Skjelstad
This belongs on the user mailing list, not the development of lwip list.

I have not uses the high level socket api, only the lower level raw tcp and udp api. In that API at least, the close() can fail due to memory pressure, not any free memory to allocate for transmission of the needed packets, and you must retry later.

Stian

On Tue, 27 Oct 2020, 22:42 Rustam Mustafin, <[hidden email]> wrote:
Good afternoon!

I am using LwIP (2.1.2) and FreeRTOS (10.3.1). LwIP in socket mode. Now I use the tcp / ip stack to create a web server. I encountered strange behavior when requesting files (pictures) from the device. On my local machine (192.168.127.2), I use wget to download files from the device (192.168.127.1). If a 505 byte icon is requested, the device sends the file normally. At the end, I see a FIN send from the device and a FIN response from the client. When I request a picture of 56 728 bytes, I see that the device has completely sent the file, but the connection is not closed. The wget utility shows that the connection is open and the file is still downloading. Although it has already downloaded (checked with binary comparison). In the case of using a browser, the pages from the device are simply not displayed, since the files hang during the transfer.

What could be the reason for this behavior? Perhaps something needs to be changed in the configuration parameters? Tried reducing the LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT timeouts, however the connection still won't close. (I looked at Wireshark).

// Implementation pseudocode:
void WebClientTask (void * p)
{
// recv (clientSock, buf1)
// find file
// write (clientSock, buf2)

// close connection
lwip_shutdown (clientSock, SHUT_RDWR);
lwip_close (clientSock);

// delete task
}

void WebServerTask (void * p)
{
// server socket
// listen
while (1) {
cl = accept
createNewTaskForClient (cl)
}
}
_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel

_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel