title: Best way to do interprocess communication on Mac OS X
body: <p>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).</p>
  
  <p>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).</p>
  
  <p>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:</p>
  
  <ul>
  <li>Reading and writing to a file (…yes), very basic but not very scalable.</li>
  <li>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</li>
  <li>Distributed Objects: seems rather inelegant for a task like this</li>
  <li><code>NSConnection</code>: I can't really figure out what this class even does, but I've read of it in some IPC search results</li>
  </ul>
  
  <p>I'm sure there are things I'm missing, but I was surprised to find a lack of resources on this topic.</p>