PeerConnectionRelease(_:_:_:_:)
Releases P2P connection resources associated with the service instance.
Declaration
func PeerConnectionRelease(_ flags: DNSServiceFlags, _ name: UnsafePointer<CChar>!, _ regtype: UnsafePointer<CChar>!, _ domain: UnsafePointer<CChar>!) -> DNSServiceErrorTypeDiscussion
When a service is resolved over a P2P interface, a connection is brought up to the peer advertising the service instance. This call will free the resources associated with that connection. Note that the reference to the service instance will only be maintained by the mDNSResponder daemon while the browse for the service type is still running. Thus the sequence of calls to discover, resolve, and then terminate the connection associated with a given P2P service instance would be:
DNSServiceRef BrowseRef, ResolveRef; DNSServiceBrowse(&BrowseRef, …) // browse for all instances of the service DNSServiceResolve(&ResolveRef, …) // resolving a service instance creates a // connection to the peer device advertising that service DNSServiceRefDeallocate(ResolveRef) // Stop the resolve, which does not close the peer connection
// Communicate with the peer application.
PeerConnectionRelease() // release the connection to the peer device for the specified service instance
DNSServiceRefDeallocate(BrowseRef) // stop the browse // Any further calls to PeerConnectionRelease() will have no affect since the // service instance to peer connection relationship is only maintained by the // mDNSResponder daemon while the browse is running.
flags: Not currently used.
name: The name of the service instance to be resolved, as reported to the DNSServiceBrowseReply callback.
regtype: The type of the service instance to be resolved, as reported to the DNSServiceBrowseReply callback.
domain: The domain of the service instance to be resolved, as reported to the DNSServiceBrowseReply callback.
return value: Returns kDNSServiceErr_NoError on success or the error that occurred.