Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Jan 2008 19:15:05 +0000
From:      "Bruce M. Simpson" <bms@FreeBSD.org>
To:        SnaiX <nayuhz@gmail.com>
Cc:        freebsd-net@freebsd.org
Subject:   Re: the socket can't bind?
Message-ID:  <4787C039.6080205@FreeBSD.org>
In-Reply-To: <00a001c85457$5e9e9c00$1bdbd400$@com>
References:  <00a001c85457$5e9e9c00$1bdbd400$@com>

next in thread | previous in thread | raw e-mail | index | archive | help
SnaiX wrote:
> So it would run 1-4. but it reports EADDRINUSE after bind.
>
> Why?

The stack assumes that SO_REUSEADDR is never cleared on a socket after 
it gets set.

>  How to resolve it? Should I dup() the fd?
>   
Did you close the affected socket in (5) ?

Presumably you are still trying to use the same port; is it a 
non-ephemeral port? You might want to consider SO_REUSEPORT although I 
believe FreeBSD doesn't fully support it for non-multicast.

BMS



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4787C039.6080205>