|From:||Couch, Kelly J|
|Subject:||[lwip-users] How to detect FIN / remote closed connection with netconn API?|
|Date:||Thu, 2 Jun 2011 15:11:49 -0700|
I am using lwip 1.4.0 and must utilize netconn_new_with_callback
My reader thread blocks on a queue that is written to by the netconn_callback. I merely detect when NETCONN_EVT_RCVPLUS is the event and write to a queue, then the blocking thread wakes up and processes the incoming data.
I have implemented something very similar to what is suggested via this thread: http://lists.gnu.org/archive/html/lwip-users/2011-02/msg00026.html
I have observed that a NETCONN_EVT_RCVPLUS with a ‘len’ of 0 coincides with connection events (but am uncertain if this is the ONLY reason for a 0 length event), like a newly established connection or a disconnected connection, however I can find no flags or other mechanism to confirm that the connection is indeed closed?
As a debugging attempt, I have tried using “netconn_set_nonblocking(pxNewConnection, TRUE);“ on a newly established connection, but calls to netconn_recv still block!?
It appears I can set the recv_timeout, which does return, but is not really the desired mechanism.
Any help is greatly appreciated.
|[Prev in Thread]||Current Thread||[Next in Thread]|