Best way to do interprocess communication on Mac OS X

Posted by jbrennan on Stack Overflow See other posts from Stack Overflow or by jbrennan
Published on 2010-05-17T02:22:01Z Indexed on 2010/05/17 2:30 UTC
Read the original article Hit count: 332

I'm looking at building a Cocoa application on the Mac with a back-end daemon process (really just a mostly-headless Cocoa app, probably), along with 0 or more "client" applications running locally (although if possible I'd like to support remote clients as well; the remote clients would only ever be other Macs or iPhone OS devices).

The data being communicated will be fairly trivial, mostly just text and commands (which I guess can be represented as text anyway), and maybe the occasional small file (an image possibly).

I've looked at a few methods for doing this but I'm not sure which is "best" for the task at hand. Things I've considered:

  • Reading and writing to a file (…yes), very basic but not very scalable.
  • Pure sockets (I have no experience with sockets but I seem to think I can use them to send data locally and over a network. Though it seems cumbersome if doing everything in Cocoa
  • Distributed Objects: seems rather inelegant for a task like this
  • NSConnection: I can't really figure out what this class even does, but I've read of it in some IPC search results

I'm sure there are things I'm missing, but I was surprised to find a lack of resources on this topic.

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about nsconnection