CFNetServiceCancel(_:)
Cancels a service registration or a service resolution.
Declaration
func CFNetServiceCancel(_ theService: CFNetService)Parameters
- theService:
The CFNetService, obtained by previously calling Cfnetservicecreate(_:_:_:_:_:), for which a registration or a resolution is to be canceled.
Discussion
This function cancels service registrations, started by CFNetServiceRegister, thereby making the service unavailable. It also cancels service resolutions, started by CFNetServiceResolve.
If you are shutting down an asynchronous service, you should first call CFNetServiceUnscheduleFromRunLoop(_:_:_:) and CFNetServiceSetClient(_:_:_:) with clientCB set to NULL. Then call this function.
If you are shutting down a synchronous service, call this function from another thread.
This function also cancels service resolutions. You would want to cancel a service resolution if your callback function has received an IP address that you’ve successfully used to connect to the service. In addition, you might want to cancel a service resolution if the resolution is taking longer than a user would want to wait or if the user canceled the operation.
Special Considerations
This function is thread safe.
See Also
Network Services
CFNetServiceCFNetServiceBrowserCFNetServiceBrowserFlagsCFNetServiceMonitorCFNetServiceMonitorTypeCFNetServiceClientContextCFNetServiceRegisterFlagsCFNetServicesErrorCFNetServiceBrowserInvalidate(_:)CFNetServiceBrowserScheduleWithRunLoop(_:_:_:)CFNetServiceBrowserCreate(_:_:_:)CFNetServiceBrowserGetTypeID()CFNetServiceBrowserSearchForDomains(_:_:_:)CFNetServiceBrowserSearchForServices(_:_:_:_:)CFNetServiceBrowserStopSearch(_:_:)