- Inherits from:
- NSObject
- Conforms to:
- NSObject
- (NSObject)
Declared in:
- Foundation/NSPortMessage.h
An NSPortMessage defines a low level, operating-system independent type for interapplication (and interthread) messages. NSPortMessages are used primarily by the distributed objects system. You should implement interapplication communication using distributed objects whenever possible, and use NSPortMessages only when necessary.
An NSPortMessage has three major parts: the send and receive ports, which are NSPorts that link the sender of the message to the receiver, and the components, which form the body of the message. The components are held as an NSArray of NSData and NSPort objects. NSPortMessage's sendBeforeDate: message sends the components out through the send port; any replies to the message arrive on the receive port. See the NSPort class specification for information on handling incoming messages.
An NSPortMessage can be initialized with a pair of NSPorts and an NSArray of components. An NSPortMessage's body can contain only NSPort objects or NSData objects. In the distributed objects system the byte/character arrays are usually encoded NSInvocations that are being forwarded from a proxy to the corresponding real object.
An NSPortMessage also maintains a message identifier, which can be used to indicate the class of a message, such as an Objective-C method invocation, a connection request, an error, and so on. Use the setMsgid: and msgid methods to access the identifier.
- Creating instances
- - initWithSendPort:receivePort:components:
- Sending the message
- - sendBeforeDate:
- Getting the components
- - components
- Getting the ports
- - receivePort
- - sendPort
- Accessing the message ID
- - setMsgid:
- - msgid
- (NSArray *)components
- (id)initWithSendPort:(NSPort
*)sendPort
receivePort:(NSPort *)receivePort
components:(NSArray *)components
components should contain only NSData and NSPort objects, and the contents of the NSData objects should be in network byte order.
See Also: - setMsgid:
- (unsigned)msgid
See Also: - setMsgid:
- (NSPort *)receivePort
See Also: - sendPort
- (BOOL)sendBeforeDate:(NSDate
*)aDate
- (NSPort *)sendPort
See Also: - receivePort
- (void)setMsgid:(unsigned)msgid
See Also: - msgid