2

I plan to use apple's DNSServiceQueryRecord to resolve SRV records. I see that the callback passed to this method is called once per record that is returned from SRV lookup. How do i know that the query has completed and all the records have been returned?

Apple's documentation for your reference.

https://developer.apple.com/library/mac/documentation/Networking/Reference/DNSServiceDiscovery_CRef/index.html#//apple_ref/c/func/DNSServiceQueryRecord

adsun
  • 773
  • 9
  • 30
  • The query runs indefinitely until you terminate it, as new services could appear at any time. You need to decide when you have "enough" answers. This could be after you have 1 answer, after a period of time or when the user/app exits your discovery view – Paulw11 May 31 '16 at 23:49
  • quick question to be totally sure : is this a blocking or non-blocking method? – adsun Jun 01 '16 at 00:03
  • non-blocking. That is why it has the callback function – Paulw11 Jun 01 '16 at 00:04
  • Thanks for the inputs. – adsun Jun 01 '16 at 00:10

1 Answers1

1

I would like to point out the method "DNSServiceProcessResult" to process the DNS result is blocking. I used select() to look if there is data received in the socket to call DNSServiceProcessResult. This makes the method unblocking. I check if there is data in socket for 2 seconds and if i don't get back any results, I cancel the query.

adsun
  • 773
  • 9
  • 30
  • 1
    This works for me: http://stackoverflow.com/questions/22502729/resolving-srv-records-with-ios-sdk Answer by @meaning-matters – ssk Jun 13 '16 at 23:48