Function

CFNetServiceBrowserStopSearch(_:_:)

Stops a search for domains or services.

Declaration

func CFNetServiceBrowserStopSearch(_ browser: CFNetServiceBrowser, _ error: UnsafeMutablePointer<CFStreamError>?)

Parameters

browser

The CFNetServiceBrowser that was used to start the search; cannot be NULL.

error

A pointer to a CFStreamError structure that will be passed to the callback function associated with this CFNetServiceBrowser (if the search is being conducted in asynchronous mode) or that is pointed to by the error parameter when CFNetServiceBrowserSearchForDomains(_:_:_:) or CFNetServiceBrowserSearchForServices(_:_:_:_:) returns (if the search is being conducted in synchronous mode). Set the domain field to kCFStreamErrorDomainCustom and the error field to an appropriate value.

Discussion

This functions stops a search started by a previous call to CFNetServiceBrowserSearchForDomains(_:_:_:) or CFNetServiceBrowserSearchForServices(_:_:_:_:). For asynchronous and synchronous searches, calling this function causes the callback function associated with the CFNetServiceBrowser to be called once for each domain or service found. If the search is asynchronous, error is passed to the callback function. If the search is synchronous, calling this function causes CFNetServiceBrowserSearchForDomains(_:_:_:) or CFNetServiceBrowserSearchForServices(_:_:_:_:) to return FALSE. If the error parameter for either call pointed to a CFStreamError structure, the CFStreamError structure contains the error code and the error code’s domain as set when this function was called.

Special Considerations

This function is thread safe.

If you are stopping an asynchronous search, before calling this function, call CFNetServiceBrowserUnscheduleFromRunLoop(_:_:_:), followed by CFNetServiceBrowserInvalidate(_:).

See Also

Network Services

class CFNetService

An opaque reference representing a CFNetService.

class CFNetServiceBrowser

An opaque reference representing a CFNetServiceBrowser.

class CFNetServiceMonitor

An opaque reference for a service monitor.

enum CFNetServiceMonitorType

Record type specifier used to tell a service monitor the type of record changes to watch for.

struct CFNetServiceClientContext

A structure provided when a CFNetService is associated with a callback function or when a CFNetServiceBrowser is created.

enum CFNetServicesError

Error codes that may be returned by CFNetServices functions or passed to CFNetServices callback functions.

func CFNetServiceBrowserInvalidate(CFNetServiceBrowser)

Invalidates an instance of a Network Service browser object.

func CFNetServiceBrowserGetTypeID() -> CFTypeID

Gets the Core Foundation type identifier for the Network Service browser object.

func CFNetServiceBrowserUnscheduleFromRunLoop(CFNetServiceBrowser, CFRunLoop, CFString)

Unschedules a CFNetServiceBrowser from a run loop and mode.

func CFNetServiceCancel(CFNetService)

Cancels a service registration or a service resolution.

func CFNetServiceGetPortNumber(CFNetService) -> Int32

This function gets the port number from a CFNetService.

func CFNetServiceGetTXTData(CFNetService) -> Unmanaged<CFData>?

Queries a network service for the contents of its TXT records.

func CFNetServiceGetTypeID() -> CFTypeID

Gets the Core Foundation type identifier for the Network Service object.

func CFNetServiceMonitorGetTypeID() -> CFTypeID

Gets the Core Foundation type identifier for all CFNetServiceMonitor instances.

func CFNetServiceMonitorInvalidate(CFNetServiceMonitor)

Invalidates an instance of a Network Service monitor object.

func CFNetServiceSetClient(CFNetService, CFNetServiceClientCallBack?, UnsafeMutablePointer<CFNetServiceClientContext>?) -> Bool

Associates a callback function with a CFNetService or disassociates a callback function from a CFNetService.

func CFNetServiceSetTXTData(CFNetService, CFData) -> Bool

Sets the TXT record for a CFNetService.