Inherits From:
NSObject
Conforms To:
NSObject (NSObject)
Declared In:
Foundation/NSPortNameServer.h
You get an NSPortNameServer by using the defaultPortNameServer
class method; never allocate and initialize an instance directly. With the default server object you can register an NSPort under a given name, making it available on the network, and also unregister it so that it can't be looked up (although other applications that have already looked up the NSPort can still use it until it becomes invalid). See the NSPort class specification for more information.
defaultPortNameServer
Returns the single instance of NSPortNameServer for the application.
portForName:
(NSString *)portName
Looks up and returns the NSPort registered under portName on the local host (by invoking portForName:onHost:
with nil
as the host name). Returns nil
if no such NSPort exists.
See also:
- portForName:onHost:
portForName:
(NSString *)portName onHost:
(NSString *)hostName
Looks up and returns the NSPort registered under portName on the host named hostName, which is an Internet domain name (for example, "sales.anycorp.com"). Returns nil
if no such NSPort exists.
If hostName is nil
or empty then only the local host is checked for portName. If hostName is "*" then all hosts on the local subnet are queried for the requested NSPort; where there are duplicates an arbitrary host's NSPort is returned. That host is then used for every subsequent request by the local host.
registerPort:
(NSPort *)aPort forName:
(NSString *)portName
Makes aPort available on the network under portName and the local host's name (or names). Returns YES if successful, NO otherwise (for example, if another NSPort has already been registered under portName). An NSPort can be registered under multiple names; if it is, it must be unregistered for each name with removePortForName:
to make it completely unavailable.
removePortForName:
(NSString *)portName
Unregisters the NSPort for the name portName on the local host, so that it can no longer be looked up by that name. Other applications that already have the NSPort can continue to use it until it becomes invalid.