lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Reconnect issue


From: Per Klint
Subject: [lwip-users] Reconnect issue
Date: Thu, 14 Jul 2011 16:26:48 +0200

Hi!

 

I have just upgraded lwip from 1.3.2 to STABLE-1.4.0.

With no changes into my actual communication code I notice that my

connections now behaves differently than before.

 

1. I create a listen socket that should be used for incoming connections (telnet).

2. I set FIONBIO to "1" on the socket with ioctl.

3. I do a bind.

4. I do a listen.

5. I do a select to see if someone is trying to connect.

6. If someone has connected I do an accept and saves that as a working socket and then close the listen socket.

7. When the telnet session is done I close the working socket and restart at point 1, creating a new listen socket.

 

However when starting over the difference occurs...

I have no problem creating a new listen socket, but when I am binding this listen socket,

I get an “Address in use” error. This error remains for about 120 seconds before  the bind is

successful, which mean that I am locked out from the system during that period.

For a telnet session this might be ok, but for other more critical connections this can be fatal.

I took a look inside the lwip code and saw that after 120 seconds the pcb was removed and

after it was possible to reconnect again.

 

Is there changes between 1.3.2. version and STABLE-1.4.0 regarding how fast it is possible to

reconnect to a recently closed socket? Or is it any other way to affect this 120 seconds period?

 

I have tried to use the newly implemented SO_REUSE option with setsockopt, and when using

that it works better, however I got problems with other tcp/ip communications stuff when using that.

So before digging into what that could be, I would like to understand why the above happens.

 

Any ideas why this behaves differently in 1.4.0?

 

Best regards,

 

/// Per

 


reply via email to

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