Contents

CFNetServiceMonitorStart(_:_:_:)

Starts monitoring.

Declaration

func CFNetServiceMonitorStart(_ monitor: CFNetServiceMonitor, _ recordType: CFNetServiceMonitorType, _ error: UnsafeMutablePointer<CFStreamError>?) -> Bool

Parameters

  • monitor:

    CFNetServiceMonitor, created by calling Cfnetservicemonitorcreate(_:_:_:_:), that is to be started.

  • recordType:

    CFNetServiceMonitorType that specified the type of record to monitor. For possible values, see Cfnetservicemonitortype.

  • error:

    Pointer to a doc://com.apple.documentation/documentation/corefoundation/cfstreamerror structure. If an error occurs, on output, the structure’s domain field will be set to the error code’s domain and the error field will be set to an appropriate error code. Set this parameter to NULL if you don’t want to receive the error code and its domain.

Return Value

TRUE if an asynchronous monitor was started successfully. FALSE if an error occurred when starting an asynchronous or synchronous monitor, or if CFNetServiceMonitorStop(_:_:) was called for an synchronous monitor.

Discussion

This function starts monitoring for changes to records of the type specified by recordType. If a monitor is already running for the service associated with the specified CFNetServiceMonitorRef, this function returns FALSE.

For synchronous monitors, this function blocks until the monitor is stopped by calling CFNetServiceMonitorStop(_:_:), in which case, this function returns FALSE.

For asynchronous monitors, this function returns TRUE or FALSE, depending on whether monitoring starts successfully.

Special Considerations

This function is thread safe.

See Also

Network Services