Documentation Archive Developer
Search

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

Updating the TXT record of a Bonjour service

Q: My application uses CFNetServiceSetProtocolSpecificInformation or setProtocolSpecificInformation to advertise some meta-data corresponding to my Bonjour service, but sometimes I need to update this meta-data after the service is registered. Is that possible?

A: No. The only workaround is to completely unregister the service and then immediately re-register it with the new data. Unfortunately, this causes additional network traffic, so if you need to update this data often, then you should move completely to the low-level DNSServiceDiscovery API.

In Mac OS X 10.2.x, the function DNSServiceRegistrationUpdateRecord from the Mach-based DNSServiceDiscovery API will allow you to update the default TXT record for a service registration. If your application only requires Mac OS X 10.3 and later, you should use the socket-based DNSServiceDiscovery API instead of the Mach-based API. The function DNSServiceUpdateRecord will allow you to update the default TXT record for a service registration.

Both of these functions require that you specify the TTL (Time-to-Live) of the TXT record. The default TTL for TXT records in Mac OS X 10.2.x is 60 seconds, but the default TTL in Mac OS X 10.3.x is 240 seconds. It's recommended that you specify a value of 0 for the TTL, which will allow mDNSResponder to automatically choose the default value.

Document Revision History

Date Notes
2004-07-14 Simplified description of work around.
2003-10-23 New document that explains how to update a Bonjour TXT record while running on either Jaguar or Panther.