NSSocketPortNameServer, DO & Daemon problems ...
NSSocketPortNameServer, DO & Daemon problems ...
- Subject: NSSocketPortNameServer, DO & Daemon problems ...
- From: Lloyd Dupont <email@hidden>
- Date: Fri, 9 May 2003 11:36:12 +1000
I use DO with NSSocketPort & NSSocketPortNameServer.
and that's ok.
however I recently tried to make my application a daemon.
so I initialize my application with stuff like:
pid_t pid;
if( (pid = fork()) < 0 )
return -1;
else if(pid != 0)
return 0;
setsid();
chdir("/");
umask(0);
and then register to DO with
NSSocketPort *sport = [[[NSSocketPort alloc] initWithTCPPort:aPort]
autorelease];
// fail on the line below
if([[NSSocketPortNameServer sharedInstance] registerPort:sport
name:aName] == NO)
return FALSE;
NSConnection * connection = [[[NSConnection alloc]
initWithReceivePort:sport sendPort:nil] autorelease];
[connection setRootObject:self];
however, when my program is running as a daemon it always fail to
register to DO with the following error:
"There was an error creating a resolve, (ipc/send) invalid destination
port"
I don't understand ... any idea ?
(and yes, the name and port are available)
_______________________________________________
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.