NSSocketPortNameServer issue
NSSocketPortNameServer issue
- Subject: NSSocketPortNameServer issue
- From: Ben Lachman <email@hidden>
- Date: Wed, 29 Dec 2004 17:36:48 -0500
I'm having some trouble removing my ports from the NSSocketPortNameServer.
Basically I set up my server this way:
localNameServer = [[NSSocketPortNameServer sharedInstance] retain];
serverPort = [[NSSocketPort alloc] initWithTCPPort:0];
serverConnection = [[NSConnection connectionWithReceivePort:serverPort sendPort:serverPort] retain];
[serverConnection setRootObject:self];
serviceName = [[NSString stringWithString:@"TextServer"] retain];
if( [localNameServer portForName:serviceName host:@"*" nameServerPortNumber:nil] == nil ) {
[localNameServer registerPort:serverPort name:serviceName];
}
And then I assume I should be able to remove it this way:
if( [localNameServer removePortForName:serviceName] == NO ) {
NSLog(@"Unable to remove port");
} else {
NSLog(@"Port removed successfully");
}
[serverPort invalidate];
[serverConnection invalidate];
But every time I run it, I am not able to restart the server with the same name. In fact, I've added some code in and I can still query the nameserver for the port and it will happily give it to me.
Anyone have any idea how I can actually make it remove the port.
TIA,
->Ben
––––––––––––––––––––––––––––––––––––––––
Ben Lachman • email@hidden
email@hidden • 740.594.9192
Apple Campus Representative
Ohio University
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden