---
title: "CFNetServiceBrowserCreate(_:_:_:)"
framework: cfnetwork
role: symbol
role_heading: Function
path: "cfnetwork/cfnetservicebrowsercreate(_:_:_:)"
---

# CFNetServiceBrowserCreate(_:_:_:)

Creates an instance of a Network Service browser object.

## Declaration

```swift
func CFNetServiceBrowserCreate(_ alloc: CFAllocator?, _ clientCB: CFNetServiceBrowserClientCallBack, _ clientContext: UnsafeMutablePointer<CFNetServiceClientContext>) -> Unmanaged<CFNetServiceBrowser>
```

## Parameters

- `alloc`: The allocator to use to allocate memory for the new object. Pass NULL or doc://com.apple.documentation/documentation/CoreFoundation/kCFAllocatorDefault to use the current default allocator.
- `clientCB`: Callback function that is to be called when domains and services are found; cannot be NULL. For details, see doc://com.apple.cfnetwork/documentation/CFNetwork/CFNetServiceBrowserClientCallBack.
- `clientContext`: Context information to be used when clientCB is called; cannot be NULL. For details, see doc://com.apple.cfnetwork/documentation/CFNetwork/CFNetServiceClientContext.

## Return Value

Return Value A new browser object, or NULL if the instance could not be created. Ownership follows the The Create Rule.

## Discussion

Discussion This function creates an instance of a Network Service browser object, called a CFNetServiceBrowser, that can be used to search for domains and for services. To use the resulting CFNetServiceBrowser in asynchronous mode, call CFNetServiceBrowserScheduleWithRunLoop(_:_:_:). Then call CFNetServiceBrowserSearchForDomains(_:_:_:) and CFNetServiceBrowserSearchForServices(_:_:_:_:) to use the CFNetServiceBrowser to search for services and domains, respectively. The callback function specified by clientCB is called from a run loop to pass search results to your application. The search continues until you stop the search by calling CFNetServiceBrowserStopSearch(_:_:). If you do not call CFNetServiceBrowserScheduleWithRunLoop(_:_:_:), searches with the resulting CFNetServiceBrowser are made in synchronous mode. Calls made to CFNetServiceBrowserSearchForDomains(_:_:_:) and CFNetServiceBrowserSearchForServices(_:_:_:_:) block until there are search results, in which case the callback function specified by clientCB is called, until the search is are stopped by calling CFNetServiceBrowserStopSearch(_:_:) from another thread, or an error occurs. To shut down a CFNetServiceBrowser that is running in asynchronous mode, call CFNetServiceBrowserStopSearch(_:_:), followed by CFNetServiceBrowserUnscheduleFromRunLoop(_:_:_:), and then CFNetServiceBrowserInvalidate(_:). Special Considerations This function is thread safe.

## See Also

### Network Services

- [CFNetService](cfnetwork/cfnetservice.md)
- [CFNetServiceBrowser](cfnetwork/cfnetservicebrowser.md)
- [CFNetServiceBrowserFlags](cfnetwork/cfnetservicebrowserflags.md)
- [CFNetServiceMonitor](cfnetwork/cfnetservicemonitor.md)
- [CFNetServiceMonitorType](cfnetwork/cfnetservicemonitortype.md)
- [CFNetServiceClientContext](cfnetwork/cfnetserviceclientcontext.md)
- [CFNetServiceRegisterFlags](cfnetwork/cfnetserviceregisterflags.md)
- [CFNetServicesError](cfnetwork/cfnetserviceserror.md)
- [CFNetServiceBrowserInvalidate(_:)](cfnetwork/cfnetservicebrowserinvalidate(_:).md)
- [CFNetServiceBrowserScheduleWithRunLoop(_:_:_:)](cfnetwork/cfnetservicebrowserschedulewithrunloop(_:_:_:).md)
- [CFNetServiceBrowserGetTypeID()](cfnetwork/cfnetservicebrowsergettypeid().md)
- [CFNetServiceBrowserSearchForDomains(_:_:_:)](cfnetwork/cfnetservicebrowsersearchfordomains(_:_:_:).md)
- [CFNetServiceBrowserSearchForServices(_:_:_:_:)](cfnetwork/cfnetservicebrowsersearchforservices(_:_:_:_:).md)
- [CFNetServiceBrowserStopSearch(_:_:)](cfnetwork/cfnetservicebrowserstopsearch(_:_:).md)
- [CFNetServiceBrowserUnscheduleFromRunLoop(_:_:_:)](cfnetwork/cfnetservicebrowserunschedulefromrunloop(_:_:_:).md)
