<!--
{
  "availability" : [
    "iOS: 2.0.0 - 27.0.0",
    "iPadOS: 2.0.0 - 27.0.0",
    "macCatalyst: 13.1.0 - 27.0.0",
    "macOS: 10.2.0 - 27.0.0",
    "tvOS: 9.0.0 - 27.0.0",
    "visionOS: 1.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NetServiceBrowser",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSNetServiceBrowser"
  },
  "title" : "NetServiceBrowser"
}
-->

# NetServiceBrowser

A network service browser that finds published services on a network using multicast DNS.

```
class NetServiceBrowser
```

## Overview

Services can range from standard services, such as HTTP and FTP, to custom services defined by other applications. You can use a network service browser in your code to obtain the list of accessible domains and then to obtain an [`NetService`](/documentation/Foundation/NetService) object for each discovered service. Each network service browser performs one search at a time, so if you want to perform multiple simultaneous searches, use multiple network service browsers.

A network service browser performs all searches asynchronously using the current run loop to execute the search in the background. Results from a search are returned through the associated delegate object, which your client application must provide. Searching proceeds in the background until the object receives a [`stop()`](/documentation/Foundation/NetServiceBrowser/stop()) message.

To use an `NSNetServiceBrowser` object to search for services, allocate it, initialize it, and assign a delegate. (If you wish, you can also use the [`schedule(in:forMode:)`](/documentation/Foundation/NetServiceBrowser/schedule(in:forMode:)) and [`remove(from:forMode:)`](/documentation/Foundation/NetServiceBrowser/remove(from:forMode:)) methods to execute searches on a run loop other than the current one.) Once your object is ready, you begin by gathering the list of accessible domains using either the [`searchForRegistrationDomains()`](/documentation/Foundation/NetServiceBrowser/searchForRegistrationDomains()) or [`searchForBrowsableDomains()`](/documentation/Foundation/NetServiceBrowser/searchForBrowsableDomains()) methods. From the list of returned domains, you can pick one and use the [`searchForServices(ofType:inDomain:)`](/documentation/Foundation/NetServiceBrowser/searchForServices(ofType:inDomain:)) method to search for services in that domain.

The `NSNetServiceBrowser` class provides two ways to search for domains. In most cases, your client should use the [`searchForRegistrationDomains()`](/documentation/Foundation/NetServiceBrowser/searchForRegistrationDomains()) method to search only for local domains to which the host machine has registration authority. This is the preferred method for accessing domains as it guarantees that the host machine can connect to services in the returned domains. Access to domains outside this list may be more limited.

## Topics

### Creating Network Service Browsers

[`-  init`](/documentation/Foundation/NetServiceBrowser/init())

Initializes an allocated [`NetServiceBrowser`](/documentation/Foundation/NetServiceBrowser) object.

### Configuring Network Service Browsers

[`delegate`](/documentation/Foundation/NetServiceBrowser/delegate)

The delegate object for this instance.

[`includesPeerToPeer`](/documentation/Foundation/NetServiceBrowser/includesPeerToPeer)

Whether to browse over peer-to-peer Bluetooth and Wi-Fi, if available.

### Using Network Service Browsers

[`-  searchForBrowsableDomains`](/documentation/Foundation/NetServiceBrowser/searchForBrowsableDomains())

Initiates a search for domains visible to the host. This method returns immediately.

[`-  searchForRegistrationDomains`](/documentation/Foundation/NetServiceBrowser/searchForRegistrationDomains())

Initiates a search for domains in which the host may register services.

[`-  searchForServicesOfType:inDomain:`](/documentation/Foundation/NetServiceBrowser/searchForServices(ofType:inDomain:))

Starts a search for services of a particular type within a specific domain.

[`-  stop`](/documentation/Foundation/NetServiceBrowser/stop())

Halts a currently running search or resolution.

### Managing Run Loops

[`-  scheduleInRunLoop:forMode:`](/documentation/Foundation/NetServiceBrowser/schedule(in:forMode:))

Adds the receiver to the specified run loop.

[`-  removeFromRunLoop:forMode:`](/documentation/Foundation/NetServiceBrowser/remove(from:forMode:))

Removes the receiver from the specified run loop.

## Relationships

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

### Conforms To

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Hashable`](/documentation/Swift/Hashable)

[`Equatable`](/documentation/Swift/Equatable)

---

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)