[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] close(), TIME_WAIT and bind()
From: |
Stéphane Lesage |
Subject: |
[lwip-users] close(), TIME_WAIT and bind() |
Date: |
Wed, 03 Mar 2010 23:15:08 +0100 |
User-agent: |
Thunderbird 2.0.0.23 (Windows/20090812) |
Hi,
In my LwIP device, I want to serve only one connection, so basically I do:
while (1)
{
trytolisten:
l = socket();
if (bind(l) < 0) { close(l); sleep(10 ms); goto trytolisten }
listen(l, 1);
s = accept();
close(l);
[...]
close(s);
}
1. When the peer closes the connection, there is no problem.
2. When my device closes the connection:
This was working fine, except for sometimes, when the connection was not
yet really closed, and the bind() fails only once.
Now (CVS head), whenever my device closes the connection, I cannot
bind() for exactly 2 minutes because the last connection stays in
TIME_WAIT...
I tried to remove the shutdown related code, without success.
What happened recently ???
--
Stephane
- [lwip-users] close(), TIME_WAIT and bind(),
Stéphane Lesage <=