Interprocess communication on Mac OS X
Interprocess communication on Mac OS X
- Subject: Interprocess communication on Mac OS X
- From: Ryan McGann <email@hidden>
- Date: Thu, 30 Jan 2003 00:54:14 -0800
Can anybody give me a suggeston on how we should implement
communications in a multi-process environment? Here's the scenario:
We have several processes, each of which may or may not be running at
any time. There is always one process running, our daemon, which runs
as root and is started via a StartupItem. The rest of the processes are
a mixture of command line tools, background-only applications and Cocoa
applications.
We need to communicate between all the process(es). For example my
daemon needs to tell our application that the preferences were changed
by the daemon, and vice versa. Most of the time the data that we're
sending is Foundation/CoreFoundation types like CFStrings.
On Mac OS X there are a plethora of IPC mechanisms, but I can't find
one that I like.
- AppleEvents: Plagued by bootstrap server issues and has problems
being used in GUI-less applications in Jaguar (it's used by some of our
other apps and I know the problems they've gone through on this one, so
it's basically out as an option).
- BSD sockets: Has no problems with bootstrap server issues and can be
used anywhere, but are slower than other lower-level mechanisms, and
harder to use with CF/Foundation types.
- CFMessagePort: Message ports created by processes in the root
boostrap context cannot be seen by non-root processes when started from
the command line (e.g. our app wouldn't be able to send messages to the
daemon if the daemon were killed by me during debugging)
- CFNotifiticaitonCenter: Since it's implemented using CFMessagePort,
has all of the above problems plus the fact that it's not very secure
(e.g. any application will receive our notifications).
- CFMachPort: Has problems of CFMessagePort since it uses the same
priveleges, plus the fact that it's much more messy
- FIFOs: Same pros/cons as BSD sockets
So, fellow developers, which would you choose? I lean towards BSD
sockets simply because they have no known issues with bootsrap contexts
and other things I barely understand, but I like the APIs for
CFMessagePort better simply because it's easier to pass CF/Foundation
types to it, which is what our application uses.
Thanks,
Ryan McGann
I'd give my right arm to be ambidextrous.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.