Class

NSMachPort

A port that can be used as an endpoint for distributed object connections (or raw messaging).

Declaration

@interface NSMachPort : NSPort

Overview

NSMachPort is a subclass of NSPort that wraps a Mach port, the fundamental communication port in macOS. NSMachPort allows for local (on the same machine) communication only. A companion class, NSSocketPort, allows for both local and remote distributed object communication, but may be more expensive than NSMachPort for the local case.

To use NSMachPort effectively, you should be familiar with Mach ports, port access rights, and Mach messages. See the Mach OS documentation for more information.

Topics

Creating and Initializing

+ portWithMachPort:

Creates and returns a port object configured with the given Mach port.

+ portWithMachPort:options:

Creates and returns a port object configured with the specified options and the given Mach port.

- initWithMachPort:

Initializes a newly allocated NSMachPort object with a given Mach port.

- initWithMachPort:options:

Initializes a newly allocated NSMachPort object with a given Mach port and the specified options.

Getting the Mach Port

machPort

The Mach port used by the receiver, represented as an integer.

Scheduling the Port on a Run Loop

- removeFromRunLoop:forMode:

Removes the receiver from the run loop mode mode of runLoop.

- scheduleInRunLoop:forMode:

Schedules the receiver into the run loop mode mode of runLoop.

Getting and Setting the Delegate

- delegate

Returns the receiver’s delegate.

- setDelegate:

Sets the receiver’s delegate to a given object.

Constants

NSMachPortOptions

Used to remove access rights to a mach port when the NSMachPort object is invalidated or destroyed.

Relationships

Inherits From

See Also

Legacy

NSMachPortDelegate

An interface for handling incoming Mach messages.

NSConnectionDelegate

An interface for interacting with low-level, interprocess connections.

Deprecated
NSConnection

An object that manages the communication between objects in different threads or between a thread and a process running on a local or remote system.

Deprecated
NSDistantObject

A proxy for objects in other applications or threads.

Deprecated
NSDistantObjectRequest

An object used by the distributed objects system to help handle invocations between different processes.

Deprecated
NSMachBootstrapServer

A port name server that takes and returns Mach port objects.

Deprecated
NSMessagePort

A port that can be used as an endpoint for distributed object connections (or raw messaging).

NSMessagePortNameServer

A server takes and returns message ports.

Deprecated
NSPortCoder

A coder used to transmit object proxies (and sometimes objects themselves) between connections.

Deprecated
NSPortDelegate

An interface for handling incoming messages.

NSPortMessage

A low-level, operating system-independent type for inter-application (and inter-thread) messages.

NSPortNameServer

An object-oriented interface to the port registration service used by the distributed objects system.

Deprecated
NSProtocolChecker

An object that restricts the messages that can be sent to another object (referred to as the checker’s delegate).

NSSocketPortNameServer

A port name server that takes and returns socket ports.

Deprecated