<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "dnssd",
  "identifier" : "/documentation/dnssd/DNSServiceCreateConnection(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "dnssd"
    ],
    "preciseIdentifier" : "c:@F@DNSServiceCreateConnection"
  },
  "title" : "DNSServiceCreateConnection(_:)"
}
-->

# DNSServiceCreateConnection(_:)

Creates a connection to the daemon, allowing efficient registration of multiple individual records.

```
func DNSServiceCreateConnection(_ sdRef: UnsafeMutablePointer<DNSServiceRef?>!) -> DNSServiceErrorType
```

## Parameters

`sdRef`

A pointer to an uninitialized DNSServiceRef. Deallocating the reference (via [`DNSServiceRefDeallocate(_:)`](/documentation/dnssd/DNSServiceRefDeallocate(_:))) severs the connection and deregisters all records registered on this connection.

## Return Value

Returns [`kDNSServiceErr_NoError`](/documentation/dnssd/kDNSServiceErr_NoError) on success, otherwise returns an error code indicating the specific failure that occurred (in which case the DNSServiceRef is not initialized).

## Discussion

---

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)