On Fri, 6 Jan 2006, izimmerman@borderware.com wrote:
> Hello there, first, if there's a FAQ, I should probably read it first, so
> point me to it and ignore the rest :-)
We don't have a FAQ! ;-)
> 1/ In our applications, we typically need more detailed access to the DNS
> answers than through gethostbyname(); i.e. the TTL for each answer, at the
> very least. But the only interface c-ares provides seems to be basically
> asynchronous gethostbyname(), or else I have to parse the DNS packets
> myself. Is this right? Would code to parse DNS replies be a welcome
> contribution to cares? Or is something planned already?
I would welcome such code. We get questions every now and then from various
people who wants to extract differnet parts from the DNS responses so I think
it would be a useful addition.
> 2/ It is not clear from the manpages if a c-ares channel acquires an
> associated socket file descriptor(s) for life, or a new one for each query.
> That is, will ares_fds(chan, &r, &w) always set the same fds in r and w for
> the same chan? I'd much rather determine these descriptors once at startup.
> This is because I need to select() on other descriptors too, and I need to
> do different things depending on which descriptors (c-ares and multiple
> "kinds" of others) are ready; so I need to remember the "kind" of each
> descriptor, which is tough if they are different each time :-(
I don't think you should make that assumption. You should instead assume that
it has changed every time and call ares_fds() accordingly.
If you have other sockets, you FD_SET them yourself after or before you call
ares_fds(). I don't see why that is a problem.
> 3/ Similarly, will ares_getsock(chan, socks, n) always set the same things
> in socks for a given chan?
ares_getsock() will have the exact same behavior like ares_fds() does, as it
just returns the info differently.
Actually, I think the sockets are likely to be the same if not for the entire
life time so at least for a long time, but I don't think it is wise to assume
that in a program using this API.
> Actually ares_getsock isn't even declared in the version of ares.h that I
> have, which has the CVS Id "ares.h,v 1.15 2005/08/18 08:48:31 bagder". I
> guess this function been added in a newer version of the library.
It was added just a week ago or so in CVS.
> Is there a moderately stable version tagged in the CVS (i.e. not the nightly
> snapshot)?
No. I'm planning a 1.3.1 release "soon". But the CVS HEAD should be fairly
stable, we have not done any major changes since the 1.3.0 release...
-- c-ares -- my preferred DNS asynch resolver libraryReceived on Fri Jan 6 23:42:43 2006