Search code examples
objective-cmacoscocoadistributed-objects

How to determine the calling object when using Distributed Objects (DO) in Objective-C?


I am using Distributed Objects (DO) in Objective-C. I have a "server" object that I have vended on the network. Other objects on the network have a proxy to my server object and can thus call methods on the server object. However, can I determine any information about the objects that are calling methods on the server object? That is, I have many "client" objects that can call the server and I would like to distinguish these objects. Also, can I determine other attributes about these objects, e.g., host name, unique identifier?


Solution

  • I found that the most effective solution to this problem is to explicitly pass a reference to the calling object as, say, the first parameter of the method. That way, the calling object can be easily identified and even called back if necessary. The resulting argument is of type NSDistantObject *.