# NSDistantObject class reference

richard@brainstorm.co.uk
mccallum@gnu.ai.mit.edu
Generated at 2025-02-13 06:02:40 +0000
1997 Free Software Foundation, Inc.
Software documentation for the NSDistantObject class
Foundation/NSDistantObject.h
NSCoding
Instances of this class act as proxies to remote objects using the Distributed Objects system. They also hold references to local objects which are vended to remote processes.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
proxyWithLocal:
anObject
connection:
aConnection
Creates and returns a proxy associated with aConnection which will hold a reference to the local object anObject.
proxyWithTarget:
anObject
connection:
aConnection
Creates and returns a proxy associated with aConnection which will provide a link to a remote object whose reference locally is anObject.
connectionForProxy
Returns the NSConnection instance with which the receiver is associated.
initWithLocal:
anObject
connection:
aConnection
Initialises and returns a proxy associated with aConnection which will hold a reference to the local object anObject.
initWithTarget:
target
connection:
aConnection
Initialises and returns a proxy associated with aConnection which will provide a link to a remote object whose reference locally is target.
methodSignatureForSelector:
aSelector

Returns the method signature describing the arguments and return types of the method in the object referred to by the receiver which implements the aSelector message.

This method may need to refer to another process (causing relatively slow network communication) and approximately double the time taken for sending a distributed objects message, so you are advised to use the -setProtocolForProxy: method to avoid this occurring.

setProtocolForProxy:
aProtocol

A key method for Distributed Objects performance. This sets the a protocol that the distant object referred to by the proxy should conform to. When messages in that protocol are sent to the proxy, the proxy knows that it does not need to ask the remote object for the method signature in order to send the message to it, but can send the message straight away based on the local method signature information obtained from the protocol.

if ([anObj isProxy] == YES) { [anObj setProtocolForProxy: @protocol(MyProtocol)]; }

It is highly recommended that you make use of this facility, but you must beware that versions of the compiler prior to 3.3 suffer a serious bug with respect to the @protocol directive. If the protocol referred to is not declared and implemented in the file where @protocol is used to refer to the protocol by name, a runtime error will occur when you try to use it.

Beware, if you don't use this method to set the protocol, the system might well ask the remote process for method signature information, and the remote process might get it wrong. This is because the class of the remote object needs to have been declared to conform to the protocol in order for it to know about any protocol qualifiers (the keywords `bycopy, byref, in, out, inout,` and `oneway`). If the author of the server process forgot to do this, the type information returned from that process may not be what you are expecting.

The class of the server object should be declared like this... @interface MyServerClass : NSObject <MyProtocol> ... @end