From owner-freebsd-questions Mon Dec 3 6: 9:10 2001 Delivered-To: freebsd-questions@freebsd.org Received: from topaz.mdcc.cx (topaz.mdcc.cx [212.204.230.141]) by hub.freebsd.org (Postfix) with ESMTP id 725E937B417 for ; Mon, 3 Dec 2001 06:09:06 -0800 (PST) Received: from k7.mavetju.org (topaz.mdcc.cx [212.204.230.141]) by topaz.mdcc.cx (Postfix) with ESMTP id 238EE2B795; Mon, 3 Dec 2001 15:08:52 +0100 (CET) Received: by k7.mavetju.org (Postfix, from userid 1001) id 0502F53; Tue, 4 Dec 2001 01:08:29 +1100 (EST) Date: Tue, 4 Dec 2001 01:08:28 +1100 From: Edwin Groothuis To: Lance Bland Cc: freebsd-questions@FreeBSD.ORG Subject: Re: bind() error on stale port ... Message-ID: <20011204010828.C546@k7.mavetju.org> Mail-Followup-To: Edwin Groothuis , Lance Bland , freebsd-questions@FreeBSD.ORG References: <20011203234721.B546@k7.mavetju.org> <069E8AC2-E7F7-11D5-A5E1-0030659A531A@vvi.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <069E8AC2-E7F7-11D5-A5E1-0030659A531A@vvi.com>; from lbland@vvi.com on Mon, Dec 03, 2001 at 09:07:03AM -0500 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, Dec 03, 2001 at 09:07:03AM -0500, Lance Bland wrote: > > On Monday, December 3, 2001, at 07:47 AM, Edwin Groothuis wrote: > > > You do it with setsockopt and SO_REUSEADDR: > > > > int x=1; > > if (setsockopt(fd6,SOL_SOCKET,SO_REUSEADDR,(char > > *)&x,sizeof(x))<0) { > > bugf("init_socket6(): SO_REUSEADDR: %s",ERROR); > > exit(1); > > } > > Why would I NOT want to set that socket option? It seems like something > I would always want to do. This is only needed for server applications, which need to bind to a specific port. For client applications, this port can be random (i.e. the port number is determined by the kernel and not by the application) > I have 1000 pages of unix socket books and also man pages, but they > don't seem to be comprehensive enough. Is there a book that describes > all the features of setsockopt() (for example)? For example,the man page > I have doesn't describe the optional parameters (e.g.: &x) to > setsockopt(). I have good experiences with Richard Stevens "Unix Networking Programming". Search amazon.com for it. But the only ones which are always up to date for your operating system are the man-pages on your machine. Edwin -- Edwin Groothuis | Personal website: http://www.MavEtJu.org edwin@mavetju.org | Interested in MUDs? Visit Fatal Dimensions: ------------------+ http://www.FatalDimensions.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message