Name

NSConnection — Mac OS X 10.0

Synopsis

This class declares the interface to objects that manage communications between objects that reside in separate processes. The NSConnection class forms the groundwork for Cocoa’s distributed objects system, which is described in more detail in Chapter 6. NSConnection supports inter-process communication on the local host, as well as between two hosts over a network. NSConnection is frequently used to facilitate communication between threads in a multithreaded application. Clients use the NSConnection class primarily for vending objects (making them available to other processes), accessing vended objects, and for fine-tuning communication parameters.

image with no caption

@interface NSConnection : NSObject
                                  // Convenience Constructors
   + (NSConnection *)connectionWithReceivePort:(NSPort *)receivePort 
                                 sendPort:(NSPort *)sendPort;
   + (NSConnection *)connectionWithRegisteredName:(NSString *)name 
                                 host:(NSString *)hostName;
   + (NSConnection *)connectionWithRegisteredName:(NSString *)name 
                                 host:(NSString *)hostName
                                 usingNameServer:(NSPortNameServer *)server;
                                  // Initializers
   - (id)initWithReceivePort:(NSPort *)receivePort 
                                 sendPort:(NSPort *)sendPort;
                                  // Accessor Methods
   - (void)setRequestTimeout:(NSTimeInterval)ti;
   - (NSTimeInterval)requestTimeout;
   - (void)setReplyTimeout:(NSTimeInterval)ti;
   - (NSTimeInterval)replyTimeout;
   - (void)setRootObject ...

Get Cocoa in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.