Using DO from daemon
Using DO from daemon
- Subject: Using DO from daemon
- From: Neil Rhodes <email@hidden>
- Date: Thu, 22 May 2003 15:17:01 -0700
I've got an command-line app that acts as a client to a distributed
objects server. The app can't get the root proxy if it's running as a
startup item, but can when run from the command-line.
The server vends its proxy with:
[self createConnectionName: @"foo"];
- (NSConnection*) createConnectionName:(NSString*)name
{
NSConnection* newConnection=[[NSConnection alloc] init];
if ([newConnection registerName:name])
{
[newConnection setRootObject:self];
}
else
{
[newConnection release];
newConnection=nil;
}
return newConnection;
}
The client obtains its proxy with:
id rootProxy = [NSConnection
rootProxyForConnectionWithRegisteredName:@"foo" host: nil];
The server is a normal Cocoa application running with user permissions.
The client is a command-line background application running as root.
If the client is launched from the command-line with:
sudo client &
it works fine (obtains the proxy and is able to successfully use it).
If the client is run from a StartupItem (/Library/StartupItems script)
with:
client &
then rootProxy is nil.
In fact, as a check, I've also tried:
NSConnection *c = [NSConnection connectionWithRegisteredName:@"foo"
host: nil];
It too returns nil.
This may be related to a posting from October, 2001
<
http://www.omnigroup.com/mailman/archive/macosx-dev/2001-October/
019728.html> where someone was having a similar problem running an
application from crontab (worked fine from the command line, failed
when running from crontab). However, there were no replies to the
question at that time.
Thanks,
Neil
--
Neil Rhodes
Calliope Enterprises, Inc.
1328 Clock Avenue
Redlands, CA 92374
(909) 793-5995
email@hidden
_______________________________________________
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.