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 callback won't do



Hi Olger,

So I feel that the next code should do the same:

    const char* fullname = "machost._afpovertcp._tcp.local.";
    //const char* fullname = "_afpovertcp._tcp.local";
    printf("looking for %s\n", fullname);
    DNSServiceErrorType err;
    DNSServiceRef client = NULL;

err = DNSServiceQueryRecord(&client,0,0,fullname,ns_t_ptr,ns_c_in,query_reply ,NULL);
if (err != kDNSServiceErr_NoError) {
printf("register returned failure:%d\n", err);
}


    DNSServiceProcessResult(client);
    DNSServiceRefDeallocate(client);

The DNSServiceQueryRecord gives a result for a query :_afpovertcp._tcp.local. (as found in the comment)
(it actually returns an rrtype = 12 not a rrtype = 1)


But it doesn't work for a single service name. (e.g: machost.....) it seems.

The documentation states to use QueryRecord if you have shared services. I am working on a service that could be available multiple times and the rendezvous based client can select on of them (you can make some algorithms which to pick)

It's not clear what you're trying to do. Have you tried using DNSServiceBrowse()? Are you using DNSServiceRegister() to advertise your services?



Is it possible to have shared services like that ? and how to use QueryRecord to get these ?
Does the DDNS close the connection after the answer or can more answers be expected based on the query at a later time ?

In your example code, you're calling DNSServiceRefDeallocate() immediately after getting the first answer, which closes the connection. You should use select() and put the socket FD in your select() loop so you can receive notifications asynchronously. You should only call DNSServiceRefDeallocate() when you no longer wish to receive notifications.


Hope that helps.

-Marc





On Nov 1, 2004, at 8:56 PM, Olger Warnier wrote:

Hi List,

I found quite an extensive discussion on the use of DNSServiceQueryRecord
and the callback found in:


Subject: DNSServiceQueryRecord (was Re: FreeBSD and Solaris)
From: Eric Wing <email@hidden>
Date: Thu, 15 Jul 2004 20:50:15 -0700 (PDT)
it is: http://lists.apple.com/archives/rendezvous-dev/2004/Jul/msg00095.html

But it ends with the remark that the callback doesn't seem to work. On a linux system, I have a situation like that:

When I use DNSServiceResolve(...) and call the DNSServiceProcessResult
(direct or with a select() loop), the service gets resolved and a hostname
+ port number is available.


But I'd like to use the DNSServiceQueryRecord instead with a seperate
select() loop to make it possible keep shared services.
Using DNSServiceQueryRecord with and call the DNSServiceProcessResult
(again direct of with a select() loop), nothing happens.

I use exact the same servicename,type and domain for both and for the
rrtype and rrclass = 1;

In order to use the DNSServiceQueryRecord, do I need to do some
initialization or something ? Or to make my question a bit more generic.
Someone has any suggestions what could solve this ?


Kind Regards,

Olger


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Rendezvous-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/rendezvous-dev/ email@hidden


This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Rendezvous-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/rendezvous-dev/email@hidden

This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Rendezvous-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/rendezvous-dev/email@hidden

This email sent to email@hidden
References: 
 >DNSServiceQueryRecord callback won't do (From: "Olger Warnier" <email@hidden>)
 >Re: DNSServiceQueryRecord callback won't do (From: Olger Warnier <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.