On 11 May 2006, at 16:05, Chris B. Vetter wrote:
On 5/11/06, Richard Frith-Macdonald <[EMAIL PROTECTED]>
wrote:
[...]
1. Creates an NSMessagePort instance
2. calls [NSMessagePortNameServer-registerPort:forname:] useing the
newly created port and a unique identifier for the bundle
[...]
That is exactly what I was trying to do:
- (id) init
{
id server = nil, port = nil;
server = [NSMessagePortNameServer sharedInstance];
port = [server portForName: @"Foobar"];
if( ! port )
{
NSLog(@"no port, creating");
port = [NSMessagePort port];
}
if( [server registerPort: port forName: @"Foobar"] )
{
NSLog(@"registered");
return self;
}
return nil;
}
Both instances will tell me that there is no port, therefor create a
new one and register.
Probably your code is not retaining the port ... so by the time the
second program runs, the port in the first program has been released.
When I took essentially the same code it worked as expected ...
int main ()
{
id server = [NSMessagePortNameServer sharedInstance];
id port = [server portForName: @"Foobar"];
if (!port)
{
NSLog(@"no port, creating");
port = [NSMessagePort port];
}
if ([server registerPort: port forName: @"Foobar"])
{
NSLog(@"registered");
sleep(60);
}
else
{
NSLog(@"not registered");
}
exit (0);
}
_______________________________________________
Discuss-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnustep