On Dec 17, 2008, at 11:01, Keith Moore wrote:
One could possibly extend getaddrinfo() or make something a bit
getaddrinfo() is perhaps already becoming too complex though. A neat
thing with extending getaddrinfo() could be to make existing code use
SRV without changes. Not exactly sure if that is good or not...
It's not. And I've heard rumors that some implementations of
getaddrinfo() already do this - which is a good reason to not use it
Well, if you want portable code with consistent behavior, you can't
use getaddrinfo with both host and service names specified, and you
still have to do the SRV queries some other way. But it may still be
the most portable way to do thread-safe IPv4+IPv6 address resolution.
I originally thought I wouldn't mind seeing a flag for getaddrinfo in
some future spec that means "do (not) look up SRV records for host
+service", but I don't think you'd get consistent defaults implemented
across all the existing implementations, some of which already do SRV
records and some of which don't; maybe we'd need both "do" and "do
not" flags. And it still wouldn't help you with looking up
"_sip._tls.example.com", so you still wind up wanting the additional
API. Still, a shortcut in getaddrinfo for the simple and most common
cases might be handy if it could be controlled.
So far as I can tell, getaddrinfo with only host *or* service name
specified is still portable and consistent... if you keep in mind the
differences between the different versions of the specs that have been
Ietf mailing list