title: Resolving SRV records with iOS SDK
body: <p>I want to resolve DNS SRV records using the iOS SDK. </p>
  
  <p>I've already tried the high-level Bonjour APIs Apple is providing, but they're not what I need. Now I'm using DNS SD.</p>
  
  <pre><code>void *processQueryForSRVRecord(void *record) {
      DNSServiceRef sdRef;
      int context;
      printf("Setting up query for record: %s\n", record);
      DNSServiceQueryRecord(&amp;sdRef, 0, 0, record, kDNSServiceType_SRV, kDNSServiceClass_IN, callback, &amp;context);
  
      printf("Processing query for record: %s\n", record);
      DNSServiceProcessResult(sdRef);
  
      printf("Deallocating query for record: %s\n", record);
      DNSServiceRefDeallocate(sdRef);
  
      return NULL;
  }
  </code></pre>
  
  <p>This works as long as it gets only correct SRV records (for example: _xmpp-server._tcp.gmail.com), but when the record is typed wrong, DNSServiceProcessResult(sdRef) goes into an infinite loop.</p>
  
  <p>Is there a way to stop DNSServiceProcessResult or <strong>must</strong> I cancel the thread calling it?</p>