[EDIT: Discontinued.]

If you want to pass your Objective-C objects across a network connection, this may be worth looking into:

There’s a few problems with Distributed Objects that bug me:

1. Uses exceptions for errors, which just feels unnatural and cumbersome in Cocoa

2. Claims to be capable of more than it really is, such as sending any single ObjC message call over the net (see mikeash’s example regarding -getObjects:range:), and acting like a normal Cocoa object

3. Defaults to synchronous message calls, potentially over the internet(!)

4. It’s guts are not interchangeable, meaning you cannot fiddle with the lower level parts at all

The framework SocketObjC is very similar to Distributed Objects, with a few major differences:

1. All messages are sent asynchronously

2. The underlying message passing system simply uses TCP via AsyncSocket

3. Instead of exceptions, problems are simply ignored (this could easily be fixed by anyone)

4. Messages with return values can handle those returned values using block callbacks, making use of what I later learned is called “Continuation Passing Style”

5. Limited to passing and returning objects that conform to NSCoding

6. Possible to add support for secure TCP message sending (via CFStream/CFSocket, via AsyncSocket)

As you can see there are some trade-offs, for better or worse. But all in all I think this is more useful than DO for passing messages across the internet.

h/t: !

Alex | May 26, 2010

Leave a Reply