Thanks Ken that worked
I wrapped up the solution in an NSConnection category in case others run into
this problem
@interface NSConnection (NetworkServiceAdditions)
+ (id) networkServiceConnectionWithName:(NSString *) inName
rootObject:(id) inRootObject;
@end
@implementation NSConnection (NetworkServiceAdditions)
+ (id) networkServiceConnectionWithName:(NSString *) inName
rootObject:(id) inRootObject;
{
NSSocketPort *port = [[NSSocketPort alloc] init];
NSConnection *connection = [NSConnection
connectionWithReceivePort: port sendPort: nil];
[[NSSocketPortNameServer sharedInstance] registerPort: port name:
inName];
[connection setRootObject: inRootObject];
return connection;
}
@end
On Sep 24, 2010, at 10:47 AM, Ken Thomases wrote:
> On Sep 24, 2010, at 1:35 AM, Ken Tozier wrote:
>
>> However, when I try to use NSSocketPortNameServer instead of
>> NSPortNameServer, I get server = nil
>>
>> server = [[NSConnection serviceConnectionWithName: @"PMXServer"
>> rootObject: self
>> usingNameServer: [NSSocketPortNameServer sharedInstance]]
>> retain];
>>
>> The documentation here serviceConnectionWithName:rootObject:usingNameServer:
>> seems to indicate that this should work.
>
> I may have been the one to direct you to this method, but I honestly don't
> know if this approach is supposed to work. Seems like it should, but...
>
> In any case, it would just be a convenience method wrapping some other
> approaches. I recommend that you try creating a receive NSSocketPort
> yourself and using +connectionWithReceivePort:sendPort: and
> -registerName:withNameServer:.
>
> In other words, my suspicion for why the other method isn't working is that
> it doesn't know how to create NSSocketPorts to go along with the specified
> name server. It's trying to use generic NSPorts or something.
>
> Regards,
> Ken
>
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]