Up
Authors
- Richard Frith-Macdonald (
richard@brainstorm.co.uk
)
-
Version: 37003
Date: 2013-08-22 09:44:54 -0600 (Thu, 22 Aug 2013)
Copyright: (C) 1998,1999,2003 Free Software Foundation, Inc.
- Declared in:
- Foundation/NSPortNameServer.h
Availability: MacOS-X 10.0.0
Method summary
+ (id)
sharedInstance;
Availability: MacOS-X 10.0.0
Obtain single instance for this host.
- (
NSPort*)
portForName: (
NSString*)name;
Availability: MacOS-X 10.0.0
Returns the
NSMessagePort
instance registered for the specified
name if it exists on the local host.
- (
NSPort*)
portForName: (
NSString*)name
onHost: (
NSString*)host;
Availability: MacOS-X 10.0.0
Returns the port registered for the specified
name (if it exists).
The
host must be an empty string or
nil
, since
NSMessagePort
instances on other hosts are inaccessible from
the current
host.
- Declared in:
- Foundation/NSPortNameServer.h
Availability: MacOS-X 10.0.0
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
+ (id)
systemDefaultPortNameServer;
Availability: MacOS-X 10.0.0
Returns the default port name server for the
process.
This is a nameserver for
host-local connections private to the current
user. If you with to create public connections or
connections to other hosts, you must use
[NSSocketPortNameServer +sharedInstance]
instead.
This default behavior may be altered by setting the
NSPortIsMessagePort
user default to
NO
, in which case an
NSSocketPortNameServer
will be used as the default system name server and
you will have to use
[NSMessagePortNameServer +sharedInstance]
for host-local, private connections.
- (
NSPort*)
portForName: (
NSString*)name;
Availability: MacOS-X 10.0.0
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.
- (
NSPort*)
portForName: (
NSString*)name
onHost: (
NSString*)host;
Availability: MacOS-X 10.0.0
Subclasses
must 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.
- (BOOL)
registerPort: (
NSPort*)port
forName: (
NSString*)name;
Availability: MacOS-X 10.0.0
Subclasses
must 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.
- (BOOL)
removePortForName: (
NSString*)name;
Availability: MacOS-X 10.0.0
Subclasses
must 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.
- Declared in:
- Foundation/NSPortNameServer.h
Availability: MacOS-X 10.0.0
Instance Variables
Method summary
+ (id)
sharedInstance;
Availability: MacOS-X 10.0.0
Returns the shared name server object for
NSSocketPort
objects.
- (
NSPort*)
portForName: (
NSString*)name
onHost: (
NSString*)host;
Availability: MacOS-X 10.0.0
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.
- (BOOL)
registerPort: (
NSPort*)port
forName: (
NSString*)name;
Availability: MacOS-X 10.0.0
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).
- (BOOL)
removePortForName: (
NSString*)name;
Availability: MacOS-X 10.0.0
Instance Variables for NSSocketPortNameServer Class
@protected NSMapTable* _nameMap;
Availability: MacOS-X 10.0.0
Warning the underscore at the start of the
name of this instance variable indicates that, even
though it is not technically private, it is
intended for internal use within the package, and
you should not use the variable in other code.
@protected NSMapTable* _portMap;
Availability: MacOS-X 10.0.0
Warning the underscore at the start of the
name of this instance variable indicates that, even
though it is not technically private, it is
intended for internal use within the package, and
you should not use the variable in other code.
Up