Re: NSConnection rootProxyForConnectionWithRegisteredName fails to find connection
Re: NSConnection rootProxyForConnectionWithRegisteredName fails to find connection
- Subject: Re: NSConnection rootProxyForConnectionWithRegisteredName fails to find connection
- From: "Doug Knowles" <email@hidden>
- Date: Mon, 21 Aug 2006 22:34:57 -0400
Just a thought: does the thread registering the connection need to
return to its runLoop before the registration takes effect?
On 8/21/06, Doug Knowles <email@hidden> wrote:
Hi, all,
I am trying to use distributed objects to communicate between threads.
In my main thread, I have a "manager" object that sets up a
connection for subordinate threads to use to onvoke methods on it.
The problem is that the connection can not be found by its registered
name.
The following snippet is direct from my application; the last two
lines were added for debugging to show that the newly registered
connection can not be found by its name.
NSPort *sendPort = [NSPort port];
NSPort *recvPort = [NSPort port];
slQueryManagerConnection = [[NSConnection alloc]
initWithReceivePort:recvPort sendPort:sendPort];
[slQueryManagerConnection setRootObject:self];
if ( [slQueryManagerConnection
registerName:@"SLNSpotlightQueryManager"] == NO ) {
NSAssert( NO, @"Failed to register query manager as server!" );
}
id managerProxy = [NSConnection
rootProxyForConnectionWithRegisteredName:@"SLNSpotlightQueryManager"
host:nil];
NSLog( @"Looking for connection, found: %@", managerProxy );
The assertion does not fail, so I assume the registration succeeds,
but the log displays:
2006-08-21 21:11:33.165 SLNavigator[6451] Looking for connection, found: (null)
I suspect I'm missing something really basic. Any ideas?
As always, TIA.
Doug K;
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden