<!--
{
  "availability" : [
    "iOS: 2.0.0 - 27.0.0",
    "iPadOS: 2.0.0 - 27.0.0",
    "macCatalyst: 13.1.0 - 27.0.0",
    "macOS: 10.4.0 - 27.0.0",
    "tvOS: 9.0.0 - 27.0.0",
    "visionOS: 1.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "CFNetwork",
  "identifier" : "/documentation/CFNetwork/CFNetServiceMonitorStop(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "CFNetwork"
    ],
    "preciseIdentifier" : "c:@F@CFNetServiceMonitorStop"
  },
  "title" : "CFNetServiceMonitorStop(_:_:)"
}
-->

# CFNetServiceMonitorStop(_:_:)

Stops a CFNetServiceMonitor.

```
func CFNetServiceMonitorStop(_ monitor: CFNetServiceMonitor, _ error: UnsafeMutablePointer<CFStreamError>?)
```

## Parameters

`monitor`

CFNetServiceMonitor, started by calling [`CFNetServiceMonitorStart(_:_:_:)`](/documentation/CFNetwork/CFNetServiceMonitorStart(_:_:_:)), that is to be stopped.

`error`

Pointer to a <doc://com.apple.documentation/documentation/CoreFoundation/CFStreamError> structure or `NULL`. For synchronous monitors, set the `error` field of this structure to the non-zero value you want to be set in the `CFStreamError` structure when [`CFNetServiceMonitorStart(_:_:_:)`](/documentation/CFNetwork/CFNetServiceMonitorStart(_:_:_:)) returns. Note that when it returns, [`CFNetServiceMonitorStart(_:_:_:)`](/documentation/CFNetwork/CFNetServiceMonitorStart(_:_:_:)) returns `FALSE.` If the monitor was started asynchronously, set the `error` field to the non-zero value you want the monitor’s callback to receive when it is called. If this parameter is `NULL`, default values for the `CFStreamError` structure are used: the domain is set to `kCFStreamErrorDomainNetServices` and the error code is set to `kCFNetServicesErrorCancel`.

## Discussion

This function stops the specified monitor. Call [`CFNetServiceMonitorStart(_:_:_:)`](/documentation/CFNetwork/CFNetServiceMonitorStart(_:_:_:)) if you want to start monitoring again.

If you want to stop monitoring and no longer need to monitor record changes, call [`CFNetServiceMonitorInvalidate(_:)`](/documentation/CFNetwork/CFNetServiceMonitorInvalidate(_:)) instead of this function.

### Special Considerations

This function is thread safe.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)