Re: weird problem ...
Re: weird problem ...
- Subject: Re: weird problem ...
- From: Andrew Pinski <email@hidden>
- Date: Thu, 8 May 2003 22:10:00 -0400
mach ports cannot be done except after an exec, not fork.
Thanks,
Andrew Pinski
On Thursday, May 8, 2003, at 20:39 US/Eastern, Lloyd Dupont wrote:
I use DO with NSSocketPort & NSSocketPortNameServer.
and that's ok.
however I recently tried to make my application a daemon.
so I initialize 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.
_______________________________________________
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.