Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DNSServiceQueryRecord



Eric,

On Jul 19, 2004, at 2:49 PM, Eric Wing wrote:

The API documentation says
QueryRecord wants a fullname where:

fullname
Pointer to the full name of the resource record. Call
DNSServiceConstructFullName to construct the full name
from a service name, a registration type, and a domain
name.

I thought the fullname returned by ResolveReply was
what I wanted, but it looks like I needed hostname.
And I thought DNSServiceContructFullName returned the
same string as the fullname I was using.

Is this a bug in the documentation, or am I
misinterpreting the terminology?

It's a bug in that the documentation should be improved. The DNSServiceQueryRecord API can be used to query for any type of resource record. Some of the records will be named after the service name, and some of the records will be named after the local hostname. It really depends on what you're querying.




(I using the documentation from:
http://developer.apple.com/documentation/Networking/Conceptual/ dns_discovery_api/index.htm
which seems to be same as the documentation in my
Xcode 1.5 beta seed).


And what is the implication for the other functions
that claim to use "fullname"? (i.e.
DNSServiceRegisterRecord
DNSServiceReconfirmRecord
Do these need the fullname or the hosttarget?

Again, it depends. Sometimes you'll want to register an address record with a name like "foobar.local." and sometimes you'll want to register a DNS-SD TXT record with a name like "foobar._http._tcp.local.".




Also, one other question that I've been wondering
about. Is there an elegent way for handling IPv4 and
IPv6 using the Query call? It seems that I have to
know before hand since I have to specify the rrtype.
If I look for the wrong type, my program seems to
block indefinitely. I could query for both, but I
presume most likely, one of them will hang. I could
force a timeout with select, but I'm not sure how long
it should be. If it's too long, the user will
experience a noticable delay, especially since it was
likely that I wouldn't try to resolve until the user
requested it and they are now waiting explicitly for
me to connect them.

You should never block when doing a query. You should always be prepared for the possibility that the query could go unanswered. When doing address record queries, you'll need to make to separate calls to DNSServiceQueryRecord to get the IPv4 and IPv6 addresses of the target host, and then you should try connecting to each returned IP address until one of them succeeds.


Best Regards,

-Marc
_______________________________________________
rendezvous mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/rendezvous
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: DNSServiceQueryRecord (From: Eric Wing <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.