- Discovering Services
- Using a Service
- Connecting Links
- Summary
Using a Service
Finding the needed network information from the DNS server is called resolution. To resolve a service, an application performs a DNS lookup for a SRV record with the name of the service. The multicast DNS responder responds with the SRV record containing the current socket information, which consists of the port number and IP address for the service. The application then uses this information to connect to the service.
Programmers have to be careful to cancel the Resolve operation after results are obtained, however. If they don't do so, query packets are sent every few minutes to keep the DNS resource records up-to-date in the local machine's Rendezvous cache. Starting in Mac OS X 10.3, failure to cancel the Resolve will cause the following message to appear in the system log:
Date 12:57:54 admin mDNSResponder[266]: 37755: DNSServiceResolver
(My Machine._http._tcp.local.) has remained active for over two minutes.
This places considerable burden on the network.
If you as a user notice this error notification while troubleshooting your system, there's not much you can do about it. Solving the root cause means changing the code of the application. Some applications (such as iChat, for example) need to continually monitor the TXT record mentioned earlier for a buddy's current status. There are specific API calls to get only the TXT part into the application, rather than get the entire SRV, TXT, and address. This keeps network traffic to only those packets that are necessary to be sent.
Apple's Technical Q&A QA1298 addresses another potential problem for coders, that of getting back a zeroed-out sockaddr in the Resolve callback function. Because 10.3 and above supports IPv6 address records, this means you got an IPv6 address and parsed it like an IPv4 address. The note also has some boilerplate C code to make sure that IPv6 addresses are handled correctly.