Subject: Re: accepting both ipv4 and v6 connections
To: Jeff Rizzo <riz@boogers.sf.ca.us>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-net
Date: 05/12/2004 13:50:34
--ftEhullJWpWg/VHq
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Wed, May 12, 2004 at 09:50:58AM -0700, Jeff Rizzo wrote:
> On Wed, May 12, 2004 at 02:56:25AM -0400, der Mouse wrote:
> > This is rather broken. There is no excuse for assuming that the v6
> > address will be the first one in the returned list; getaddrinfo()'s
> > interface contract makes no promises about what order the returned list
> > is in.
>=20
> Yes, I figured as much. Seems like the (or at least _a_) more correct
> thing to do is to loop over all the AI_PASSIVE addresses returned
> and open a listening socket for each. Would an fd_set be appropriate
> for carrying around the group of listening fds opened, since
> we don't actually know how many sockets we'll open? Right now, the
> code passes around a single "listen_fd", so I'd like to suggest some
> changes that have the least impact on the code structure, and changing
> it to pass around an fd_set seems (to my untrained eye, anyway) to
> be the simplest change to make.
How does the code listen for things? Does it use select(2) or poll(2)?=20
Whatever it needs for waiting for work would probably be the best thing to=
=20
pass around. If you use select(2), and FD_SET will probably be fine; you=20
have to make sure your socket numbers are in the right range to begin=20
with. :-)
Take care,
Bill
--ftEhullJWpWg/VHq
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)
iD8DBQFAoo4aWz+3JHUci9cRAr8dAKCAepRDfdXcho9dyQZwMGcZ3Hc1HQCfdeFS
0I636pIKRu8tALsevdtV8h4=
=3zBS
-----END PGP SIGNATURE-----
--ftEhullJWpWg/VHq--