On 2013-04-30, Grant Edwards <grant.b.edwa...@gmail.com> wrote: > I've recently noticed that when using the FreeBSD TCP stack, the > connect() system call ignores the SO_REUSEADDRESS setting and returns > EADDRINUSE when attempting to connect a TCP socket if a connection > with the same (SrcIP,SrcPort,DstIP,DstPort) tuple is still hanging > around in the TIME_WAIT state.
It appears that the work-around for this is to set the SO_LINGER option with a timeout of 0 before calling close(). That reportedly sends a RST instead of a FIN, and the socket doesn't hang around in the TIME_WAIT state... -- Grant Edwards grant.b.edwards Yow! Thousands of days of at civilians ... have produced gmail.com a ... feeling for the aesthetic modules -- -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss