This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: BSD TCP connect() ignores SO_REUSEADDR option
- From: Grant Edwards <grant dot b dot edwards at gmail dot com>
- To: ecos-discuss at ecos dot sourceware dot org
- Date: Tue, 30 Apr 2013 19:39:56 +0000 (UTC)
- Subject: Re: BSD TCP connect() ignores SO_REUSEADDR option
- References: <klp4vo$r2b$1 at ger dot gmane dot org>
On 2013-04-30, Grant Edwards <grant.b.edwards@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