Mac Developer Library

Developer

Foundation Framework Reference NSConnectionDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

NSConnectionDelegate

Inheritance


Not Applicable

Conforms To


Import Statement


Not Applicable

Objective-C

@import Foundation;

Availability


Available in OS X v10.6 and later.

The NSConnectionDelegate protocol defines the optional methods implemented by delegates of NSConnection objects.

  • Returns a Boolean value that indicates whether given authentication data is valid for a given set of components.

    Declaration

    Objective-C

    - (BOOL)authenticateComponents:(NSArray *)components withData:(NSData *)authenticationData

    Parameters

    components

    An array that contains NSData and NSPort objects belonging to an NSPortMessage object. See the NSPortMessage class specification for more information.

    authenticationData

    Authentication data created by the delegate of the peer NSConnection object with authenticationDataForComponents:.

    Return Value

    YEStrue if the authenticationData provided is valid for components, otherwise NOfalse.

    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.

    Import Statement

    Objective-C

    @import Foundation;

    Availability

    Available in OS X v10.0 and later.

    Available as part of an informal protocol prior to OS X v10.6.

  • Returns an NSData object to be used as an authentication stamp for an outgoing message.

    Declaration

    Objective-C

    - (NSData *)authenticationDataForComponents:(NSArray *)components

    Parameters

    components

    An array containing the elements of a network message, in the form of NSPort and NSData objects.

    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:.

    Import Statement

    Objective-C

    @import Foundation;

    Availability

    Available in OS X v10.0 and later.

    Available as part of an informal protocol prior to OS X v10.6.

  • Returns a Boolean value that indicates whether the parent connection should allow a given new connection to be created.

    Declaration

    Objective-C

    - (BOOL)connection:(NSConnection *)parentConnection shouldMakeNewConnection:(NSConnection *)newConnnection

    Parameters

    parentConnection

    The connection object for which the receiver is the delegate.

    newConnnection

    The new connection.

    Return Value

    YEStrue if parentConnection should allow newConnnection to be created and set up, NOfalse 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.

    Import Statement

    Objective-C

    @import Foundation;

    Availability

    Available in OS X v10.0 and later.

    Available as part of an informal protocol prior to OS X v10.6.

  • This method should be implemented by NSConnection object delegates that want to intercept distant object requests.

    Declaration

    Objective-C

    - (BOOL)connection:(NSConnection *)conn handleRequest:(NSDistantObjectRequest *)doReq

    Parameters

    conn

    The connection object for which the receiver is the delegate.

    doReq

    The distant object request.

    Return Value

    YEStrue if the request was handled by the delegate, NOfalse if the request should proceed as if the delegate did not intercept it.

    Import Statement

    Objective-C

    @import Foundation;

    Availability

    Available in OS X v10.0 and later.

    Available as part of an informal protocol prior to OS X v10.6.

  • Returns an arbitrary object identifying a new conversation being created for the connection in the current thread.

    Declaration

    Objective-C

    - (id)createConversationForConnection:(NSConnection *)conn

    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 YEStrue for conn. If you do not implement this method, NSConnection object creates an instance of NSObject.

    Import Statement

    Objective-C

    @import Foundation;

    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)

  • Returns a Boolean value that indicates whether the parent should allow a given new connection to be created and configured.

    Declaration

    Objective-C

    - (BOOL)makeNewConnection:(NSConnection *)newConnection sender:(NSConnection *)parentConnection

    Parameters

    newConnection

    The new connection.

    parentConnection

    The parent connection.

    Return Value

    YEStrue if parentConnection should allow newConnnection to be created and configured, NOfalse 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.

    Import Statement

    Objective-C

    @import Foundation;

    Availability

    Available in OS X v10.0 and later.

    Available as part of an informal protocol prior to OS X v10.6.