lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] How to detect a FIN from the remote side


From: address@hidden
Subject: Re: [lwip-users] How to detect a FIN from the remote side
Date: Mon, 07 Dec 2009 16:51:56 +0100
User-agent: Thunderbird 2.0.0.23 (Macintosh/20090812)

We *do* have documentation for such questions! In case you still don't find it:

On 22/11/2009, address@hidden wrote:
> Excerpt from doc/rawapi.txt:
> "The callback function will be passed a NULL pbuf to indicate that the
> remote host has closed the connection."
>
> Does that make it clear enough?

Simon



Marco Jakobs wrote:
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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]