NSConnectionDelegate Protocol Reference
| Conforms to | |
| Framework | /System/Library/Frameworks/Foundation.framework |
| Availability | Available in OS X v10.6 and later. |
| Companion guide | |
| Declared in | NSConnection.h |
Overview
The NSConnectionDelegate protocol defines the optional methods implemented by delegates of NSConnection objects.
Instance Methods
authenticateComponents:withData:
Returns a Boolean value that indicates whether given authentication data is valid for a given set of components.
Parameters
- components
An array that contains
NSDataandNSPortobjects belonging to anNSPortMessageobject. See theNSPortMessageclass specification for more information.- authenticationData
Authentication data created by the delegate of the peer
NSConnectionobject withauthenticationDataForComponents:.
Return Value
YES if the authenticationData provided is valid for components, otherwise NO.
Discussion
Use this message for validation of incoming messages. An NSConnection object raises an NSFailedAuthenticationException on receipt of a remote message the delegate doesn’t authenticate.
Availability
- Available in OS X v10.0 and later.
- Available as part of an informal protocol prior to OS X v10.6.
Declared In
NSConnection.hauthenticationDataForComponents:
Returns an NSData object to be used as an authentication stamp for an outgoing message.
Parameters
- components
An array containing the elements of a network message, in the form of
NSPortandNSDataobjects.
Return Value
An NSData object to be used as an authentication stamp for an outgoing message.
Discussion
The delegate should use only the NSData elements to create the authentication stamp. See the NSPortMessage class specification for more information on the components.
If authenticationDataForComponents: returns nil, an NSGenericException will be raised. If the delegate determines that the message shouldn’t be authenticated, it should return an empty NSData object. The delegate on the other side of the connection must then be prepared to accept an empty NSData object as the second parameter to authenticateComponents:withData: and to handle the situation appropriately.
The components parameter will be validated on receipt by the delegate of the peer NSConnection object with authenticateComponents:withData:.
Availability
- Available in OS X v10.0 and later.
- Available as part of an informal protocol prior to OS X v10.6.
Declared In
NSConnection.hconnection:handleRequest:
This method should be implemented by NSConnection object delegates that want to intercept distant object requests.
Parameters
- conn
The connection object for which the receiver is the delegate.
- doReq
The distant object request.
Return Value
YES if the request was handled by the delegate, NO if the request should proceed as if the delegate did not intercept it.
Availability
- Available in OS X v10.0 and later.
- Available as part of an informal protocol prior to OS X v10.6.
Declared In
NSConnection.hconnection:shouldMakeNewConnection:
Returns a Boolean value that indicates whether the parent connection should allow a given new connection to be created.
Parameters
- parentConnection
The connection object for which the receiver is the delegate.
- newConnnection
The new connection.
Return Value
YES if parentConnection should allow newConnnection to be created and set up, NO if parentConnection should refuse and immediately release newConnection.
Discussion
Use this method to limit the amount of NSConnection objects created in your application or to change the parameters of child NSConnection objects.
Use NSConnectionDidInitializeNotification instead of this delegate method if possible.
Availability
- Available in OS X v10.0 and later.
- Available as part of an informal protocol prior to OS X v10.6.
Declared In
NSConnection.hcreateConversationForConnection:
Returns an arbitrary object identifying a new conversation being created for the connection in the current thread.
Parameters
- conn
The connection object for which the receiver is the delegate.
Return Value
An arbitrary object identifying a new conversation being created for the connection in the current thread.
Discussion
New conversations are created only if independentConversationQueueing is YES for conn. If you do not implement this method, NSConnection object creates an instance of NSObject.
Availability
- Available in OS X v10.0 and later.
- Available as part of an informal protocol prior to OS X v10.6.
See Also
-
+ currentConversation -
conversation(NSDistantObjectRequest)
Declared In
NSConnection.hmakeNewConnection:sender:
Returns a Boolean value that indicates whether the parent should allow a given new connection to be created and configured.
Parameters
- newConnection
The new connection.
- parentConnection
The parent connection.
Return Value
YES if parentConnection should allow newConnnection to be created and configured, NO if parentConnection should refuse and immediately release newConnection.
Discussion
Use this method to limit the number of NSConnection objects created in your application or to change the parameters of child NSConnection objects.
Use NSConnectionDidInitializeNotification instead of this delegate method if possible.
Availability
- Available in OS X v10.0 and later.
- Available as part of an informal protocol prior to OS X v10.6.
Declared In
NSConnection.h© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-04-15)