In article <tgogolin-1AD49B.07113212072003hermes-ge0.rdc-kc.rr.com>,
tgogolin <tgogolinmac.removethis.com> wrote:
By default, NSConnection uses NSPort, which uses Mach ports. Mach ports> Some time a go I wrote a few simple games in Cocoa as a learning
> excercise. Now I'm trying to use Distributed Objects to add a
> multi-player facet to these games, using a single game server process
> and multiple client processes.
> I'm able to form a connection correctly between a server and a client on
> the same machine, using
> server = [[NSConnection rootProxyForConnectionWithRegisteredName:
> "tjg_game_server" host: hostAddress] retain];
> where hostAddress is either nil or an empty string. But when I try to
> use "172.25.19.100" (the address on my "server" machine, as displayed
> in SystemPrefs/Network), I can't make a connecttion; the server comes
> back as null. This failure happens even when I run the client process on
> the same machine as the server process! I know the address is correct,
> because ping succeeds using that address.
> Every example of rootProxyForConnectionWithRegisteredName:host: that I
> have been able to find on the web seems to use nil as the host. Well
> that works just fine, but I'd like to make a connection to a different
are machine-local; that is, they don't work over a network.
But all is not lost. You can use NSSocketPorts instead of NSPorts with
NSConnection, which gives you Distributed Objects running over TCP. You
can't vend objects by name (at least not without using Rendezvous), but
it works pretty well.
Look at the bottom of:
There's some sample code which should get you started on how to make the
connection. It's a bit more complex than the Mach port way, but it's not