Re: Distributed Objects in Foundation Tool [adjunct]
Re: Distributed Objects in Foundation Tool [adjunct]
- Subject: Re: Distributed Objects in Foundation Tool [adjunct]
- From: Luke Evans <email@hidden>
- Date: Sun, 6 Sep 2009 17:28:18 -0700
Mmm... I can see a run loop running on the stack of the main thread of
my frozen app when it is trying to obtain the proxy.
So, I'm guessing that I don't have to do anything special to get the
right run loop apparatus on the thread - it looks like the call to -
[NSConnection rootProxy] knows how to create a run loop on the thread
and wait for a reply from the remote machine... which possibly never
comes.
Still not sure which piece of string and sealing wax isn't configured
right though...
On 2009-09-06, at 3:17 PM, Luke Evans wrote:
Somebody may be able to provide clue here and save me a deal of
time...
I'm intending using DO between a Foundation Tool and what is
currently a normal Cocoa app. I have used DO before between 2
normal Cocoa apps (i.e. where NSApplication starts the run loop
etc.) - that just worked first time with no problems, but a
Foundation App probably needs a little more TLC.
Right now, I have some test code in my 'main' function that attempts
to connect to a remote object. This seems to be able to produce an
NSConnection (I provide a sendPort configured with IP and port of
the remote socket/NSConnection, and receivePort is nil).
However, when I attempt to get the 'distant object' proxy, the call
never returns.
I'm trying to figure out how to get a handle on what's happening
here, and there are a bunch of questions to work on:
1. If you manage to get a connection instance, does that mean the
connection is established correctly?
2. What runloop apparatus do I need to have various pieces of this
work?
So far, regarding (1), I have tried to connect to arbitrary ports on
the remote machine, and indeed get different (expected) behaviour:
an NSPortTimeoutException. So, I have reason to believe that when
the NSConnection instance is returned, things should be set up
correctly.
I'm beginning to think that (2) is where the issue lies. I've read
that replies use a special NSConnectionReplyMode, and that might
also explain why I can't even get the NSDistantObject from -
[NSConnection rootProxy] at this time (because I run a runloop at
the bottom of my main function).
Anyway, while I fiddle with trying to find a magic incantation and
particularly, how I should configure my runloop in a foundation app
to get DO to work (and then where it will work), someone might
already have some insight into how to get this going.
Cheers
-- Luke
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden