Re: NSSocketPortNameServer problem
Re: NSSocketPortNameServer problem
- Subject: Re: NSSocketPortNameServer problem
- From: Douglas Davidson <email@hidden>
- Date: Thu, 26 Sep 2002 12:04:49 -0700
On Wednesday, September 25, 2002, at 10:35 PM, Sean Hill wrote:
Is the documentation about Distributed Objects on Jaguar correct?
I can't seem to register my objects using the [NSSocketPortNameServer
sharedInstance] and get DO working across machines.
Does this indeed work? Distributed objects on the local machine works
perfectly.
[[NSConnection defaultConnection] registerName:serverName
withNameServer:[NSSocketPortNameServer sharedInstance]]
This always returns NO for me... doesn't matter what name I try.
The defaultConnection uses a default NSPort, not an NSSocketPort, which
means that you cannot register it with the NSSocketPortNameServer. You
will need to create your own NSSocketPort, and create your own
connection from it, in order to use the NSSocketPortNameServer.
Something like this will do the trick:
port = [[NSSocketPort alloc] initWithTCPPort:12345];
connection = [NSConnection connectionWithReceivePort:port sendPort:nil];
[connection setRootObject:@"foo"];
[[NSSocketPortNameServer sharedInstance] registerPort:port name:@"foo"];
Douglas Davidson
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.