Re: Distributed Objects NSPortTimeoutException
Re: Distributed Objects NSPortTimeoutException
- Subject: Re: Distributed Objects NSPortTimeoutException
- From: John Pannell <email@hidden>
- Date: Mon, 17 Mar 2008 06:15:54 -0600
Hi there-
This may or may not apply to your situation, but I had an incident a
few weeks ago in which I could not get DO to work with communication
between machines using NSSocketPorts. I was on Leopard and using
garbage collection. When I posted to the list, I received a response
from an authoritative source that Leopard has a known issue with
garbage collection and DO over sockets, and that there is presently no
workaround, aside from moving back to managing your own memory.
Hope this helps!
John
On Mar 16, 2008, at 11:38 PM, Mac QA wrote:
Hi,
I've been working on a project using Distributed Objects, and been
having an issue that I haven't been able to debug all week. I started
with the example code from Chapter 18 & 19 of the Advanced Mac OS X
Programming book -- its the chat server (chatterd) and chat client
(ChatterClient) programs.
http://borkware.com/corebook/second-edition-files/18-distributed-objects.tar.gz
http://borkware.com/corebook/second-edition-files/19-bonjour.tar.gz
The problem I have in my program based off this example is that when
my client tries to get the rootProxy for the connection to the server
a NSPortTimeoutException is raised with the reason "[NSPortCoder
sendBeforeTime:sendReplyPort:] timed out." I've spent the entire week
stripping out the complexities of my program and figuring out which
modification from the sample code introduces this problem. Well, I've
finally discovered what modification causes the problem, but I still
don't know why.
In the sample code the NSconnection is created inside of the main. In
my program I have a a GUI & AppController, with a button that when
pressed sends an action to a method that does the same stuff from main
in the sample code to set-up the connection. With just this
modification the sample code breaks in the same way my code breaks.
So, for those following along from the code at the URLs above, in the
chatterd project, the following
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSRunLoop *runloop = [NSRunLoop currentRunLoop];
ConnectionMonitor *monitor = [[ConnectionMonitor alloc] init];
ChatterServer *chatterServer = [[ChatterServer alloc] init];
// etc..
is changed to:
int main (int argc, const char * argv[])
{
return NSApplicationMain(argc, (const char **) argv);
}
And an AppController is added, along with a MainMenu.nib. The nib has
a button whose action is connected to a method on the AppController.
And the contents of main from line 12 through 48 is put in that
method. Specifically, that is:
ConnectionMonitor *monitor = [[ConnectionMonitor alloc] init];
// through
[[NSNotificationCenter defaultCenter]
addObserver:monitor
selector:@selector(connectionDidDie:)
name:NSConnectionDidDieNotification
object:nil];
The result ends up being that the client can no longer connect to the
server. It gets the aforementioned exception raised, yet I can't find
any reason why. Can anyone provide any suggestions?
_______________________________________________
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
_______________________________________________
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