Name

NSSocketPort — Mac OS X 10.0

Synopsis

This subclass of NSPort provides an interface to objects that can serve as endpoints for distributed objects connections over a network. NSSocketPort is implemented using the BSD Sockets API, which makes it useful for raw network communications in addition to serving as a component of the distributed objects system. A socket file descriptor that is suitable for use with the BSD Sockets API can be obtained by sending a socket message to an instance of this class.

While local communication is supported in socket ports, it is generally more efficient in terms of resource usage to use NSMachPort or NSMessagePort for local distributed objects connections.

image with no caption

@interface NSSocketPort : NSPort
                                  // Initializers
   - (id)init;
   - (id)initRemoteWithProtocolFamily:(int)family 
                                 socketType:(int)type 
                                 protocol:(int)protocol 
                                 address:(NSData *)address;
   - (id)initRemoteWithTCPPort:(unsigned short)port 
                                 host:(NSString *)hostName;
   - (id)initWithProtocolFamily:(int)family  
                                 socketType:(int)type 
                                 protocol:(int)protocol 
                                 address:(NSData *)address;
   - (id)initWithProtocolFamily:(int)family  
                                 socketType:(int)type 
                                 protocol:(int)protocol 
                                 socket:(NSSocketNativeHandle)sock;
   - (id)initWithTCPPort:(unsigned short)port;
                                  // Instance Methods
   - (NSData *)address;
   - (int)protocol;
   - (int)protocolFamily;
   - (NSSocketNativeHandle)socket;
   - (int)socketType;

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.