Date: Sun, 16 Sep 2001 02:02:32 +0100 From: Ben Smithurst <ben@FreeBSD.org> To: Stephen Montgomery-Smith <stephen@math.missouri.edu> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Could not bind Message-ID: <20010916020232.J43502@strontium.shef.vinosystems.com> In-Reply-To: <3BA3F70D.27C2136@math.missouri.edu> References: <3BA3F70D.27C2136@math.missouri.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
--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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010916020232.J43502>