From owner-freebsd-hackers Sat Sep 15 18: 2:39 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from scientia.demon.co.uk (scientia.demon.co.uk [212.228.14.13]) by hub.freebsd.org (Postfix) with ESMTP id ABE7F37B403 for ; Sat, 15 Sep 2001 18:02:34 -0700 (PDT) Received: from strontium.shef.vinosystems.com ([192.168.91.36] ident=root) by scientia.demon.co.uk with esmtp (Exim 3.30 #1) id 15iQKO-0005nk-00; Sun, 16 Sep 2001 02:02:32 +0100 Received: (from ben@localhost) by strontium.shef.vinosystems.com (8.11.6/8.11.4) id f8G12WI12959; Sun, 16 Sep 2001 02:02:32 +0100 (BST) (envelope-from ben@FreeBSD.org) X-Authentication-Warning: strontium.shef.vinosystems.com: ben set sender to ben@FreeBSD.org using -f Date: Sun, 16 Sep 2001 02:02:32 +0100 From: Ben Smithurst To: Stephen Montgomery-Smith Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Could not bind Message-ID: <20010916020232.J43502@strontium.shef.vinosystems.com> References: <3BA3F70D.27C2136@math.missouri.edu> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="oplxJGu+Ee5xywIT" Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3BA3F70D.27C2136@math.missouri.edu> X-PGP-Key: http://www.smithurst.org/ben/pgp-key.txt Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --oplxJGu+Ee5xywIT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Stephen Montgomery-Smith wrote: > listenfd=3Dsocket(AF_INET,SOCK_STREAM,0); > bzero(&servaddr,sizeof(servaddr)); > servaddr.sin_family=3DAF_INET; > servaddr.sin_addr.s_addr=3Dhtonl(INADDR_ANY); > servaddr.sin_port=3Dhtons(3000); > if (bind(listenfd,(struct sockaddr*)&servaddr,sizeof(servaddr)) < 0) You probably need to set the SO_REUSEADDR socket option; Stevens talks about this eventually, maybe you haven't read that far. Basically you need something like int foo =3D 1; and then call setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, &foo, sizeof foo); between the socket() and listen() calls. Check setsockopt(2) and Stevens for more information (and to make sure I got the arguments and stuff right!) --=20 Ben Smithurst / ben@FreeBSD.org FreeBSD: The Power To Serve http://www.FreeBSD.org/ --oplxJGu+Ee5xywIT Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE7o/onbPzJ+yzvRCwRAi7IAJ9f+mOpZeSsxEfwrYezntV2h4VrhgCfbmJS iuJigiDKd1wqw6HStTjCzdI= =/rIA -----END PGP SIGNATURE----- --oplxJGu+Ee5xywIT-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message