NSMessagePortNameServer Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/Foundation.framework
Availability
Available in OS X v10.0 and later.
Companion guide
Declared in
NSPortNameServer.h

Overview

This port name server takes and returns instances of NSMessagePort. Port removal functionality is not supported in NSMessagePortNameServer; if you want to cancel a service, you have to destroy the port (invalidate the NSMessagePort object given to registerPort:name:).

Tasks

Getting the Server Object

Getting Ports By Name

Class Methods

sharedInstance

Returns the singleton instance of NSMessagePortNameServer.

+ (id)sharedInstance
Return Value

The singleton instance of NSMessagePortNameServer with which you register and look up NSMessagePort objects.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSPortNameServer.h

Instance Methods

portForName:

Returns the NSPort object registered under a given name on the local host.

- (NSPort *)portForName:(NSString *)portName
Parameters
portName

The port name.

Return Value

The NSPort registered under portName on the local host Returns nil if a port named portName does not exist.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSPortNameServer.h

portForName:host:

Returns the NSPort object registered under a given name on the local host.

- (NSPort *)portForName:(NSString *)portName host:(NSString *)hostName
Parameters
portName

The port name.

hostName

The host name. Because NSMessagePortNameServer is a local-only server, hostName must be the empty string or nil.

Return Value

The NSPort object registered under a given name on the local host. Returns nil if a port named portName does not exist.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSPortNameServer.h