Ticket #233: test.c

File test.c, 0.6 KB (added by acfoltzer, 8 months ago)
Line 
1#include <dns_sd.h>
2#include <stdio.h>
3#include <stdlib.h>
4
5void cb(DNSServiceRef sdRef,
6        DNSServiceFlags flags,
7        uint32_t interfaceIndex,
8        DNSServiceErrorType errorCode,
9        const char *serviceName,
10        const char *regtype,
11        const char *replyDomain,
12        void *context) {
13  printf("called!\n");
14}
15
16int main() {
17  DNSServiceRef sd = malloc(sizeof(DNSServiceRef));
18  const char *regtype = "_http._tcp";
19  DNSServiceErrorType err1 = DNSServiceBrowse(&sd, 0, 0, regtype, NULL, &cb, NULL);
20  printf("err1=%d\n", err1);
21  DNSServiceErrorType err2 = DNSServiceProcessResult(sd);
22  printf("err2=%d\n", err2);
23  return 0;
24}