[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] tcp_close() and lwip still holds pcb
From: |
Kieran Mansley |
Subject: |
Re: [lwip-users] tcp_close() and lwip still holds pcb |
Date: |
Fri, 20 Mar 2009 09:13:26 +0000 |
On Fri, 2009-03-20 at 09:10 +0100, Reither, Robert (AU14) wrote:
> This means, lwip still holds the pcb for 2*TCP_MSL == 120s and than
> frees the pcb in tcp_slowtmr.
>
> Is this the correct style, I mean the client has already terminated
> the connection, why does lwip still wait for some response ??
Yes, this is correct. TCP is very cautious about delayed packets from
one connection interfering with a later connection, and so it holds one
end in TIME_WAIT to prevent the same port numbers being used for a
while. This isn't lwIP specific - it's part of every TCP. That said,
there have been lots of attempts to subvert this behaviour: windows for
example will use RSTs rather than a FIN to close a connection sometimes,
and there is an SO_REUSEADDR socket option that (if implemented - I
doubt it is in lwIP) allows you to reuse the ports that are in TIME_WAIT
in some circumstances.
Kieran