Hi,
i'm acting as a MODBUS/TCP server and discovered a problem with a test
application using a TCP connection. As my IP server task handles
several protocols, i'm using the lwIP API with a timeout criteria for
the receive function:
modsrvbuf=0;
modsrvsession->recv_timeout=1; // Set timeout to 1ms
modsrvbuf=netconn_recv(modsrvsession); //Receive data
(if some are there)
if (modsrvbuf!=0) // Buffer was assigned (there
were some data
{
... process incoming data
This works perfectly.
But one of my test programs only sends a FIN when i choose there to
close the connection. With this, lwIP does not detect a connection
close for the TCP (this is OK, because a remote FIN does not close the
TCP connection). But now my connection is stuck in the open state.
My problem is to get the information about the FIN which is sent by
the remote side. I do not find any functions in the lwIP API to detect
this. So the only way is a timer for each connection, closing it i.e.
60 seconds after the last received packet.
Or is there a way to detect the remote FIN and close the connection by
myself?
Thank you,
Marco
------------------------------------------------------------------------
_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users