I am using Lwip on an STM32F7 system along with FreeRTOS and our own
system harness ode. Lwip is generally working very well supporting a
number of TCPIP services and client functions. However we have one
small issue.
If we call netconn_close() shortly after a netconn_write() the remote
host often does not get data from the netconn_write() unless we put in
a short delay before netconn_close() is called. An example is in a
simple HTTP server like:
while(1){
// Accept any incoming connection
accept_err = netconn_accept(osocketListen, &osocket);
if(accept_err == ERR_OK){
dl4printf("Listen: accept connection\n");
netconn_set_recvtimeout(osocket, 10000);
// Serve connection
err = processRequest();
// We shouldn't need this but TCP write packets can be
lost if we don't for some reason
delayMs(1);
// Close connection
netconn_close(osocket);
// Delete connection
netconn_delete(osocket);
osocket = 0;
}
}
In this case, depending on how much is written by netconn_write(), a
WEB browser will display a window stating that the client has closed
the connection unless the 1 ms delay is included. The processRequest()
function uses netconn_recv() and netconn_write() with the flag
NETCONN_COPY. All of the netconn HTTP processing is within one thread.
I am unclear from the documentation and code if netconn_close() will
wait for the TCPIP write buffers to be sent before closing or not. I
have tried setting the lwip config option LWIP_SO_LINGER in case that
was needed but this didn't have any effect. Any info on if
netconn_close() should wait for the write buffers to be sent and if so
what config options may be needed to provide this behaviour ?
_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users