Up

NSPortNameServer class reference

Authors

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

Version: 1.51

Date: 2003/07/22 08:52:37

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


Contents -

  1. Software documentation for the NSMessagePortNameServer class
  2. Software documentation for the NSPortNameServer class
  3. Software documentation for the NSSocketPortNameServer class
  4. Software documentation for the NSPortNameServer(GNUstep) category

Software documentation for the NSMessagePortNameServer class

NSMessagePortNameServer : NSPortNameServer

Declared in:
Foundation/NSPortNameServer.h
Standards:

Description forthcoming.

Method summary

sharedInstance

+ (id) sharedInstance;

Description forthcoming.


Software documentation for the NSPortNameServer class

NSPortNameServer : NSObject

Declared in:
Foundation/NSPortNameServer.h
Standards:

The abstract port name server class. This defines an API for working with port name servers... objects used to manage access to ports in the distributed objects system (see NSConnection ).

Method summary

systemDefaultPortNameServer

+ (id) systemDefaultPortNameServer;

Returns the default port name server for the process.
The MacOS-X documentation says that this is a nameserver dealing with NSMessagePort objects, but that is incompatible with OpenStep/OPENSTEP/NeXTstep behavior, so GNUstep returns a name server which deals with NSSocketPort objects capable of being used for inter-host communications.


portForName:

- (NSPort*) portForName: (NSString*)name;

Looks up the port with the specified name on the local host and returns it or nil if no port is found with that name.
Different nameservers have different namespaces appropriate to the type of port they deal with, so failing to find a named port with one nameserver does not guarantee that a port does with that name does not exist.
This is a convenience method calling -portForName:onHost: with a nil host argument.


portForName:onHost:

- (NSPort*) portForName: (NSString*)name onHost: (NSString*)host;
Subclasses should override this method.

Looks up the port with the specified name on host and returns it or nil if no port is found with that name.
Different nameservers have different namespaces appropriate to the type of port they deal with, so failing to find a named port with one nameserver does not guarantee that a port does with that name does not exist.


registerPort:forName:

- (BOOL) registerPort: (NSPort*)port forName: (NSString*)name;
Subclasses should override this method.

Registers port with the supplied name, so that other processes can look it up to contact it. A port may be registered with more than one name by making multiple calls to this method.
Returns YES on success, NO otherwise.
The common cause for failure is that another port is already registered with the name. Raises NSInvalidArgumentException if given bad arguments.


removePortForName:

- (BOOL) removePortForName: (NSString*)name;
Subclasses should override this method.

Removes any port registration for the supplied name (whether registered in the current process or another).
The common cause for failure is that no port is registered with the name.
Raises NSInvalidArgumentException if given bad arguments.


Software documentation for the NSSocketPortNameServer class

NSSocketPortNameServer : NSPortNameServer

Declared in:
Foundation/NSPortNameServer.h
Standards:

This is the nameserver handling ports used for distributed objects communications (see NSConnection ) between hosts.
Use the +sharedInstance method to get a nameserver, rather than allocating and initialising one.

Method summary

sharedInstance

+ (id) sharedInstance;

Returns the shared name server object for NSSocketPort objects.


portForName:onHost:

- (NSPort*) portForName: (NSString*)name onHost: (NSString*)host;

Concrete implementation of [NSPortNameServer -portForName:onHost:]
Looks up and returns a port with the specified name and host.
If host is nil or an empty string, this performs a lookup for a port on the current host.
If host is an asterisk ('*') then the lookup returns the first port found with the specified name on any machine on the local network.
Returns nil if no matching port could be found.


registerPort:forName:

- (BOOL) registerPort: (NSPort*)port forName: (NSString*)name;

Concrete implementation of [NSPortNameServer -registerPort:forName:]
Registers the port with the specified name such that it is available on all the IP addresses of the host on which the process is running.
Returns YES on success, NO on failure (eg the name is already in use or there is a problem registering for some reason).


removePortForName:

- (BOOL) removePortForName: (NSString*)name;

Concrete implementation of [NSPortNameServer -removePortForName:]
Unregisters the specified name from any associated port on the local host.
Returns YES on succes, NO on failure.


Software documentation for the NSPortNameServer(GNUstep) category

NSPortNameServer(GNUstep)

Declared in:
Foundation/NSPortNameServer.h
Standards:

Some extensions to make cleaning up port names easier.

Method summary

namesForPort:

- (NSArray*) namesForPort: (NSPort*)port;
Subclasses should override this method.

Return all names that have been registered with the receiver for port.


removePort:

- (BOOL) removePort: (NSPort*)port;

Remove all names registered with the receiver for port. Probably inefficient... subclasses might want to override this.


removePort:forName:

- (BOOL) removePort: (NSPort*)port forName: (NSString*)name;
Subclasses should override this method.

Remove the name if and only if it is registered with the receiver for the given port.



Up