lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Handling sudden disappearance of network i/f


From: Kieran Mansley
Subject: Re: [lwip-users] Handling sudden disappearance of network i/f
Date: Tue, 26 Sep 2006 08:48:32 +0100

On Mon, 2006-09-25 at 23:19 +0200, Janusz U. wrote:
> >> But I don't understand why when I close
> >> socket on my windows serwer the lwIP does not notify that. Only when I 
> >> close
> >> my serwer the lwIP close too (RST state?).
> >
> > I'm not sure about this bit.  What do you expect lwIP to do when your
> > server closes the connection?  How does lwIP's behaviour differ from
> > other stacks?  The connection will not be closed until your application
> > also closes it - the server closing does not mean the client can't still
> > use the connection.
> 
> I haven't noticed any disconnection on FIN packet receiving by lwIP. I don't 
> understand why.

I think you misunderstand how TCP connections are closed.  A FIN does
not mean the connection is closed.  It just means that whoever sent it
doesn't want to send any more data.  The connection is still open in the
other direction, and it is perfectly valid (and quite normal) for one
side to send a FIN, but the other end to still send data.  A connection
is not closed until both applications close it.

I've just had a look at how FINs are processed in the case of the
netconn API.  The core lwIP will call the raw API recv callback with a
NULL buffer.  This will post NULL to the netconn API's recv mbox.  The
netconn_recv() function, when it gets NULL from the mbox, returns a
length of 0.  This is standard semantics for "there are no more data to
read".

Kieran







reply via email to

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