- Inherits from:
- NSObject
- Conforms to:
- NSCoding
- (NSPort)
- NSCopying (NSPort)
- NSObject (NSObject)
Declared in:
- Foundation/NSPort.h
NSSocketPort is a subclass of NSPort which can be used as an endpoint for Distributed Object connections (or raw messaging). A companion class, NSMessagePort allows for local (on the same machine) communication only. NSSocketPort, allows for both local and remote communication, but may be more expensive than NSMessagePort for the local case; there is also no name registry service for NSSocketPorts -- clients and servers must agree on the TCP port numbers to use beforehand.
A subclass of NSPort represents a particular flavor of data transport from one process to another. Note that instances of port subclasses cannot be mixed on a particular communication channel. For example, a client cannot connect to a server using NSMessagePort if the server only supports connections made with NSSocketPort. Also, you cannot transfer instances of NSMessagePort in a message to another process over a channel which is using NSSocketPorts as its endpoints; you can only pass NSSocketPorts on such a channel. These restrictions apply to any subclasses of NSPort, not just NSMessagePort and NSSocketPort. However, you are free to create other connections to a server using other subclasses of NSPort (assuming the server supports multiple transports) and send instances of that other subclass on that channel.
- Creating instances
- - init
- - initWithTCPPort:
- - initWithProtocolFamily:socketType:protocol:address:
- - initWithProtocolFamily:socketType:protocol:socket:
- - initRemoteWithTCPPort:host:
- - initRemoteWithProtocolFamily:socketType:protocol: address:
- Getting information
- - address
- - protocol
- - protocolFamily
- - socket
- - socketType
- (NSData *)address
- (id)init
- (id)initWithTCPPort:(unsigned
short)port
- (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)initRemoteWithTCPPort:(unsigned
short)port
host:(NSString *)hostName
- (id)initRemoteWithProtocolFamily:(int)family
socketType:(int)type
protocol:(int)protocol
address:(NSData *)address
- (int)protocol
- (int)protocolFamily
- (NSSocketNativeHandle)socket
- (int)socketType