Browses for available services.


func DNSServiceBrowse(_ sdRef: UnsafeMutablePointer<DNSServiceRef?>!, _ flags: DNSServiceFlags, _ interfaceIndex: UInt32, _ regtype: UnsafePointer<Int8>!, _ domain: UnsafePointer<Int8>!, _ callBack: DNSServiceBrowseReply!, _ context: UnsafeMutableRawPointer!) -> DNSServiceErrorType



A pointer to an uninitialized DNSServiceRef. If the call succeeds then it initializes the DNSServiceRef, returns kDNSServiceErr_NoError, and the browse operation will run indefinitely until the client terminates it by passing this DNSServiceRef to DNSServiceRefDeallocate(_:).


Currently ignored, reserved for future use.


If non-zero, specifies the interface on which to browse for services (the index for a given interface is determined via the if_nametoindex() family of calls.) Most applications will pass 0 to browse on all available interfaces. See "Constants for specifying an interface index" for more details.


The service type being browsed for followed by the protocol, separated by a dot (e.g. "_ftp._tcp"). The transport protocol must be "_tcp" or "_udp". A client may optionally specify a single subtype to perform filtered browsing: e.g. browsing for "_primarytype._tcp,_subtype" will discover only those instances of "_primarytype._tcp" that were registered specifying "_subtype" in their list of registered subtypes. Additionally, a group identifier may also be specified before the subtype e.g., _primarytype._tcp:GroupID, which will discover only the members that register the service with GroupID. See DNSServiceRegister for more details.


If non-NULL, specifies the domain on which to browse for services. Most applications will not specify a domain, instead browsing on the default domain(s).


The function to be called when an instance of the service being browsed for is found, or if the call asynchronously fails.


An application context pointer which is passed to the callback function (may be NULL).

Return Value

Returns kDNSServiceErr_NoError on success (any subsequent, asynchronous errors are delivered to the callback), otherwise returns an error code indicating the error that occurred (the callback is not invoked and the DNSServiceRef is not initialized).