Contents

registerName:withNameServer:

Registers a service with the specified port name server.

Declaration

- (BOOL) registerName:(NSString *) name withNameServer:(NSPortNameServer *) server;

Parameters

  • name:

    The name under which to register the receiver.

  • server:

    The name server.

Return Value

true if the operation was successful, otherwise false (for example, if another NSConnection object on the same host is already registered under name).

Discussion

This method connects the receive port of the receiving NSConnection object with the specified service name. If the operation is successful, other NSConnection objects can contact the receiver using the connectionWithRegisteredName:host: and rootProxyForConnectionWithRegisteredName:host: class methods.

If the receiver was already registered under a name and this method returns false, the old name remains in effect. If this method is successful, it also unregisters the old name.

To unregister an NSConnection object, simply invoke registerName: and supply nil as the connection name.

See Also

Vending a Service