more DO mysteries ...
more DO mysteries ...
- Subject: more DO mysteries ...
- From: Lloyd Dupont <email@hidden>
- Date: Fri, 30 May 2003 16:42:59 +1000
just for fun (& test) I try my registerServer / unregister method in a
row, then execl of the program itself.
quite mysteriously execl failed with error 45.. any idea ?
(if I don't call registerServer/unregister, execl work like a breeze
...)
I do
[srv registerServer];
[srv unregister];
execl("./SpyServer", "./SpyServer", "start", NULL);
IHLog("exec failed(%d): %s", errno, currenterror());
I get
exec failed(45): Operation not supported
with
- (BOOL) registerServer
{
if(port < 0) {
NSConnection * conn = [NSConnection defaultConnection];
[conn setRootObject: self];
return [conn registerName: name];
}
else {
if(connection) // already registered
return TRUE;
NSSocketPort *sport = [[[NSSocketPort alloc]
initWithTCPPort:port] autorelease];
if([[NSSocketPortNameServer sharedInstance] registerPort:sport
name:name]
== NO) {
IHLog("registerPort failed: %s", currenterror());
return FALSE;
}
connection = [[NSConnection alloc] initWithReceivePort:sport
sendPort:nil];
[connection setRootObject:self];
service = [RendezvousHelper publish:name
port:[sport TCPPort] // in case
port = 0
ofType:type];
[service retain];
return TRUE;
}
}
- (void) unregister
{
if(port < 0) {
NSConnection * conn = [NSConnection defaultConnection];
[conn setRootObject: nil];
[conn registerName:nil];
}
else
[[NSSocketPortNameServer sharedInstance]
removePortForName:name];
[service stop];
[service release];
service = nil;
[connection release];
connection = nil;
}
_______________________________________________
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.