netutils use of socket descriptor
Holger Weiß
holger at CIS.FU-Berlin.DE
Sun Jun 21 18:32:50 CEST 2009
* Thomas Guyot-Sionnest <dermoth at aei.ca> [2009-06-17 16:18]:
> While the above patch doesn't change any behavior, I was wondering if it
> could loop in case we get a mix of IPv4/v6 addresses and one of the two
> isn't supported. It looks like it would return EINVAL (Unknown protocol,
> or protocol family not available.) in that case, but I'm not experienced
> at all in sockets...
The getaddrinfo(3) call will currently provide IPv4 addresses only, as
hints.ai_family is set to PF_INET. Of course, it would be nice if this
could be changed in order to support IPv6, too. But even then, I don't
see a reason to handle EINVAL (or EPROTONOSUPPORT) specially. Simply
loop over all available addresses and use the first one that works,
regardless of why any others don't work.
Holger
------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
More information about the Developers
mailing list