On Sep 30, 2010, at 11:17 AM, Oleg Krupnov wrote:

> NSSocketPort* port = [[NSSocketPort alloc] initWithTCPPort:1234];
> NSConnection* connectionPoint = [[NSConnection alloc]
> initWithReceivePort:port sendPort:nil];
> if ([connectionPoint registerName:CONNECTION_NAME
> withNameServer:[NSSocketPortNameServer sharedInstance]])
> 
> This time it registered, but on client side I get nil when asking for proxy:
> 
> proxy = [NSConnection
> rootProxyForConnectionWithRegisteredName:CONNECTION_NAME host:nil];
> 
> I get nil. I tried "localhost" and "128.0.0.1" for host, but still no luck.

Try +rootProxyForConnectionWithRegisteredName:host:usingNameServer: and specify 
the socket port name server (similar to what you did, above).

> There must be something simple I've overlooked? The docs do not tell
> how to set up sockets easily, only Mach ports come by default...

There are multiple approaches.  You can use the initializers of NSSocketPort to 
create socket ports.  You can use one of the -portForName:... methods of 
NSSocketPortNameServer to obtain a socket port for communicating with the named 
service.

Once you have the socket ports, you can create NSConnection objects from them, 
as you did above.

Cheers,
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]

Reply via email to