NSPort

NSPort Mac OS X 10.0

This class is an abstract class that declares the interface to objects that serve as endpoints for communication between two threads or tasks. Cocoa's distributed objects system implements interprocess communication using subclasses of NSPort. The Foundation framework implements three concrete subclasses of NSPort: NSMessagePort, NSMachPort, and NSSocketPort. NSMessagePort and NSMachPort are used for local communications only, while NSSocketPort can be used for either local or remote communication over a network.

figs/cocn_1375.gif

@interface NSPort : NSObject <NSCoding, NSCopying>
 // Convenience Constructors
   + (NSPort *)port;
 // Accessor Methods
   - (void)setDelegate:(id)anId;
   - (id)delegate;
 // Class Methods
   + (id)allocWithZone:(NSZone *)zone;
 // Instance Methods
   - (void)addConnection:(NSConnection *)conn toRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode;
   - (BOOL)isValid;
   - (void)invalidate;
   - (void)removeConnection:(NSConnection *)conn fromRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode;
   - (void)removeFromRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode;
   - (unsigned)reservedSpaceLength;
   - (void)scheduleInRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode;
   - (BOOL)sendBeforeDate:(NSDate *)limitDate components:(NSMutableArray *)components from:(NSPort *)receivePort
        reserved:(unsigned)headerSpaceReserved;
   - (BOOL)sendBeforeDate:(NSDate *)limitDate msgid:(unsigned)msgID components:(NSMutableArray *)components
        reserved:(unsigned)headerSpaceReserved;
 // Methods Implementing NSCoding
   - (void)encodeWithCoder:(NSCoder *)aCoder;
   - (id)initWithCoder:(NSCoder *)aDecoder;
 // Methods Implementing NSCopying
   - (id)copyWithZone:(NSZone *)zone;
// Methods Implemented by the Delegate
   - (void)handlePortMessage:(NSPortMessage *)message;

Subclasses

NSMessagePort, NSSocketPort



    Part II: API Quick Reference
    Chapter 13. Foundation Classes