Distributed Objects NSPortTimeoutException
Distributed Objects NSPortTimeoutException
- Subject: Distributed Objects NSPortTimeoutException
- From: "Mac QA" <email@hidden>
- Date: Mon, 17 Mar 2008 01:38:28 -0400
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