---
title: "DNSServiceCreateConnection(_:)"
framework: dnssd
role: symbol
role_heading: Function
path: "dnssd/dnsservicecreateconnection(_:)"
---

# DNSServiceCreateConnection(_:)

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

## Declaration

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

## Parameters

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

## Return Value

Return Value Returns kDNSServiceErr_NoError on success, otherwise returns an error code indicating the specific failure that occurred (in which case the DNSServiceRef is not initialized).

## See Also

### Special Purpose Calls

- [DNSServiceReconfirmRecord(_:_:_:_:_:_:_:)](dnssd/dnsservicereconfirmrecord(_:_:_:_:_:_:_:).md)
- [DNSServiceRegisterRecord(_:_:_:_:_:_:_:_:_:_:_:_:)](dnssd/dnsserviceregisterrecord(_:_:_:_:_:_:_:_:_:_:_:_:).md)
- [PeerConnectionRelease(_:_:_:_:)](dnssd/peerconnectionrelease(_:_:_:_:).md)
