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

# NetServiceDelegate

The interface a net service uses to inform its delegate about the state of the service it offers.

```
protocol NetServiceDelegate : NSObjectProtocol
```

## Overview

The [`NetServiceDelegate`](/documentation/Foundation/NetServiceDelegate) protocol defines the optional methods implemented by delegates of [`NetService`](/documentation/Foundation/NetService) objects.

## Topics

### Using Network Services

[`-  netServiceWillPublish:`](/documentation/Foundation/NetServiceDelegate/netServiceWillPublish(_:))

Notifies the delegate that the network is ready to publish the service.

[`-  netService:didNotPublish:`](/documentation/Foundation/NetServiceDelegate/netService(_:didNotPublish:))

Notifies the delegate that a service could not be published.

[`-  netServiceDidPublish:`](/documentation/Foundation/NetServiceDelegate/netServiceDidPublish(_:))

Notifies the delegate that a service was successfully published.

[`-  netServiceWillResolve:`](/documentation/Foundation/NetServiceDelegate/netServiceWillResolve(_:))

Notifies the delegate that the network is ready to resolve the service.

[`-  netService:didNotResolve:`](/documentation/Foundation/NetServiceDelegate/netService(_:didNotResolve:))

Informs the delegate that an error occurred during resolution of a given service.

[`-  netServiceDidResolveAddress:`](/documentation/Foundation/NetServiceDelegate/netServiceDidResolveAddress(_:))

Informs the delegate that the address for a given service was resolved.

[`-  netService:didUpdateTXTRecordData:`](/documentation/Foundation/NetServiceDelegate/netService(_:didUpdateTXTRecord:))

Notifies the delegate that the TXT record for a given service has been updated.

[`-  netServiceDidStop:`](/documentation/Foundation/NetServiceDelegate/netServiceDidStop(_:))

Informs the delegate that a [`publish()`](/documentation/Foundation/NetService/publish()) or [`resolve(withTimeout:)`](/documentation/Foundation/NetService/resolve(withTimeout:)) request was stopped.

### Accepting Connections

[`-  netService:didAcceptConnectionWithInputStream:outputStream:`](/documentation/Foundation/NetServiceDelegate/netService(_:didAcceptConnectionWith:outputStream:))

Called when a client connects to a service managed by Bonjour.

## Relationships

### Inherits From

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

---

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)