Can Bonjour browse a service with a particular name?
- by Roman
Bonjour provides "DNSSD.browse(serviceType,callBackObject)" method which browses for services of a particular type. If a service of the given type is found, Bonjour call "callBackObject.serviceFound". If the service is lost, Bonjour calls "callBackObject.serviceLost".
I alway considered "DNSSD.browse" as a method for monitoring a particular service. Bonjour monitors a particular service and calls necessary method if the service is found (available) or lost (not available).
But than I realized that "DNSSD.browse" receives (as argument) a type of service (for example "http.tcp") and there can be several services of this type. So, its probably calls "serviceFound" and "serviceLost" if any service of the specified type is found or lost, respectively.
But in my application I would like to browse just for one particular service. What is the best way to do it? I have two potential solutions:
When I register a service, I give it a unique type. For example: "server1.http.tcp".
I register services with unique names (not types) and ask Bonjour to browse for services with particular names. But I am not sure that Bonjour provide such possibility. Can it browse for services with specific names?