DekGenius.com
[ Team LiB ] Previous Section Next Section

NSConnection Mac OS X 10.0

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.

figs/cocn_1319.gif

@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:(id)anObject;
   - (id)rootObject;
   - (void)setDelegate:(id)anObject;
   - (id)delegate;
   - (void)setIndependentConversationQueueing:(BOOL)yorn;
   - (BOOL)independentConversationQueueing;
 // Class Methods
   + (NSArray *)allConnections;
   + (id)currentConversation;
   + (NSConnection *)defaultConnection;
   + (NSDistantObject *)rootProxyForConnectionWithRegisteredName:(NSString *)name host:(NSString *)hostName;
   + (NSDistantObject *)rootProxyForConnectionWithRegisteredName:(NSString *)name host:(NSString *)hostName     
        usingNameServer:(NSPortNameServer *)server;
 // Instance Methods
   - (void)invalidate;
   - (void)addRunLoop:(NSRunLoop *)runloop;
   - (void)enableMultipleThreads;
   - (void)addRequestMode:(NSString *)rmode;
   - (BOOL)isValid;
   - (NSArray *)localObjects;
   - (BOOL)multipleThreadsEnabled;
   - (NSPort *)receivePort;
   - (BOOL)registerName:(NSString *)name;
   - (BOOL)registerName:(NSString *)name withNameServer:(NSPortNameServer *)server;
   - (NSArray *)remoteObjects;
   - (void)removeRequestMode:(NSString *)rmode;
   - (void)removeRunLoop:(NSRunLoop *)runloop;
   - (NSArray *)requestModes;
   - (NSDistantObject *)rootProxy;
   - (void)runInNewThread;
   - (NSPort *)sendPort;
   - (NSDictionary *)statistics;
// Methods Implemented by the Delegate
   - (BOOL)authenticateComponents:(NSArray *)components withData:(NSData *)signature;
   - (NSData *)authenticationDataForComponents:(NSArray *)components;
   - (BOOL)connection:(NSConnection *)ancestor shouldMakeNewConnection:(NSConnection *)conn;
   - (BOOL)connection:(NSConnection *)connection handleRequest:(NSDistantObjectRequest *)doreq;
   - (id)createConversationForConnection:(NSConnection *)conn;
   - (BOOL)makeNewConnection:(NSConnection *)conn sender:(NSConnection *)ancestor;

    [ Team LiB ] Previous Section Next Section