netdev
[Top] [All Lists]

Re: SO_REUSEADDR behavior different from BSD

To: Fernando Gont <fernando@xxxxxxxxxxx>
Subject: Re: SO_REUSEADDR behavior different from BSD
From: "Michael T Kerrisk" <mtk-lists@xxxxxxx>
Date: Mon, 9 Aug 2004 15:29:30 +0200 (MEST)
Cc: netdev@xxxxxxxxxxx
References: <4.3.2.7.2.20040807232436.00d6da60@xxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
> At 11:34 05/08/2004 -0700, YOSHIFUJI Hideaki wrote:
> 
> > > Now, on Linux, at this point, the second instance of the
> > > server fails with EADDRINUSE, even though it did use
> > > SO_REUSEADDR.  On FreeBSD 5.1, the second server instance
> > > does successfully bind.
> >
> >This behavior is intended.
> >First socket is REQUIRED to set SO_REUSEADDR
> >I hate BSD's behavior because it is asynmetry.
> >(Both sockets are required to agree on "REUSEADDR.")
> 
> Not sure what you mean by "asymetry".

Ferando,

By asymmetry, I understand Hideaki to mean that BSD requires 
SO_REUSEADDR in the second server bind(), but not the first.
the Linux philosophy then appears to be symmetry: both server
instances must agree that the socket port is reusable (i.e., 
both must set SO_REUSEADDR).

Cheers,

Michael

-- 
Michael Kerrisk
mtk-lists@xxxxxxx

NEU: WLAN-Router für 0,- EUR* - auch für DSL-Wechsler!
GMX DSL = supergünstig & kabellos http://www.gmx.net/de/go/dsl


<Prev in Thread] Current Thread [Next in Thread>