registerPort:name:nameServerPortNumber:
Registers a given port as a network service with the specified name in the local domain.
Declaration
- (BOOL) registerPort:(NSPort *) port name:(NSString *) name nameServerPortNumber:(uint16_t) portNumber;Parameters
- port:
The port to make available.
- name:
The name for the port.
- portNumber:
The
portNumberparameter is ignored.
Return Value
Discussion
If your application has already registered a port under the name portName, this method replaces it with port.
If the local domain already has a port named portName registered, this method could return true before the name collision is detected. To detect a potential name collision, you can invoke portForName:host: with a host argument of @"*" to test if portName is already taken. This, however, leaves a race condition wherein another process can register a port under portName after portForName:host: returns but before you register port. If this is an unacceptable risk for your application, you can also invoke portForName:host: some finite time after registering your port to test if you get the same port back.