Up

# NSPortMessage class reference

### Authors

Richard Frith-Macdonald (`richard@brainstorm.co.uk`)

Date: Generated at 2025-02-13 06:02:40 +0000

Copyright: (C) 1998,2000 Free Software Foundation, Inc.

# Software documentation for the NSPortMessage class

## NSPortMessage : NSObject

> Declared in:
>   Foundation/NSPortMessage.h

Availability: OpenStep

The data transported for distributed objects communications is sent over the network encapsulated by NSPortMessage objects, which consist of two NSPort s (sender and receiver, not sent over the network) and a body consisting of one or more NSData or NSPort objects. (Data in the NSData must be in network byte order.)

See the NSConnection and NSPortCoder classes.

Method summary

- -components
- -initWithMachMessage:
- -initWithSendPort:receivePort:components:
- -msgid
- -receivePort
- -sendBeforeDate:
- -sendPort
- -setMsgid:

### components

- (NSArray*) components;
Availability: OpenStep
Returns the message components originally used to constitute this message.

### initWithMachMessage:

- (id) initWithMachMessage: (void*)buffer;
Availability: OpenStep
OpenStep compatibility.

### initWithSendPort: receivePort: components:

- (id) initWithSendPort: (NSPort*)aPort receivePort: (NSPort*)anotherPort components: (NSArray*)items;
Availability: OpenStep
This is a designated initialiser for the class.
Initializes to send message described by items (which should contain only NSPort and/or NSData objects, with contents in network byte order) over aPort. If/when a reply to the message is sent, it will arrive on anotherPort.

### msgid

- (unsigned) msgid;
Availability: OpenStep
Returns ID for message. This is not used by the distributed objects system, but may be used in custom ways by cooperating applications to sort or otherwise organize messages. Set to 0 initially.

### receivePort

- (NSPort*) receivePort;
Availability: OpenStep
For an outgoing message, returns the port on which a reply to this message will arrive. For an incoming message, returns the port this message arrived on.

### sendBeforeDate:

- (BOOL) sendBeforeDate: (NSDate*)when;
Availability: OpenStep
Request that the message be sent before when. Will block until either sends it (returns `YES`) or when expires (returns `NO`). The latter may occur if many messages are queued up (by multiple threads) faster than they can be sent over the network.

### sendPort

- (NSPort*) sendPort;
Availability: OpenStep
For an outgoing message, returns the port the receiver will send itself through. For an incoming message, returns the port replies to the receiver should be sent through.

### setMsgid:

- (void) setMsgid: (unsigned)anId;
Availability: OpenStep
Sets ID for message. This is not used by the distributed objects system, but may be used in custom ways by cooperating applications to sort or otherwise organize messages.

Up