NSMessagePort/NSSocketPort & Distributed Objects
NSMessagePort/NSSocketPort & Distributed Objects
- Subject: NSMessagePort/NSSocketPort & Distributed Objects
- From: James Bucanek <email@hidden>
- Date: Sat, 15 Sep 2007 12:35:11 -0700
Greetings,
I've returned, once again, to my client/daemon communications conundrum.
I'm desperately seeking example code that successfully uses
either NSMessagePort or NSSocketPort using a local domain socket
to create an NSConnection.
If you somehow missed my hundred-odd whiny posts in the past,
let me recap: My project has several daemon and client processes
that communicate using distributed objects. Because of Mach
namespace issues, it's impossible for some processes to "see"
either the clients or daemons.
This technote
(<http://developer.apple.com/technotes/tn2005/tn2083.html>),
kindly provided by Dave Camp, strongly suggests that using Mach
ports to communicate with daemons is bad. If you need
interprocess communications that gets around problems like
namespaces one should use BSD sockets. It provides some Core
Foundation example code that uses local (AF_UNIX) sockets.
"Great!" I say to myself. I'll just replace the default NSPort
stuff with either NSMessagePort or NSSockPort created from an
AF_UNIX socket and I'll be back in business. However, after over
a day of experimentation I have yet to get this to work.
I can't even remember all of the combinations that I've tried,
but in the end I get one of four results: The client can't
see/connect to the server, the client connects but hangs when it
calls [NSConnection rootProxy], the client crashes with a bad
address when it calls rootProxy, the client throws some kind of
connection exception when it calls rootProxy.
What's shocking -- and a little scary -- is that I can find
virtually NO working code examples using DO via NSMessagePort or
NSSocketPort using local sockets. A search of
developer.apple.com's example source turns up zero hits. Even a
code.Google search doesn't turn up much. I was able to find a
thread on the list from 2005 titled "NSSocketPort vs. AF_UNIX"
that implies that someone got this to work, but there wasn't
enough code to reproduce it.
Any pointers would be greatly appreciated.
--
James Bucanek
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden