Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[NSPortCoder sendBeforeTime:sendReplyPort:] timed out



Hi,
I do not seem to be able to catch an exception and gracefully send a
message to my user if the below code, which connects to a server on
port 8808 with the string myHost. When myHost is a valid address, and
the my server application is not running is when I get a hang from
cocoa. In debug, all goes well until I get to the server =
[[connection rootProxy] retain]; then I get the hang. The below is
what I get in my run debug. How do I catch this exception and return
out of this method? Or how does one catch an invalid NSConnection
before setting up a rootProxy?

[NSPortCoder sendBeforeTime:sendReplyPort:] timed out


-(void)setServer
{
NSString *bun = [[NSBundle mainBundle] bundlePath];
NSString *p = [bun stringByAppendingPathComponent:
@"/hostSettings"];
NSString *oldHost = [NSString stringWithContentsOfFile: p];
NSString *myHost;

if(!oldHost || [oldHost isEqualToString: @""])
{
[questionView setString: @"Unable to connect to server. Please
use Host Configuration to set host."];
return;
}
else
{
[[ConfigureHostController sharedConfigureController] setHost:
oldHost];
myHost = oldHost;
}

NSSocketPort *port = [[[NSSocketPort alloc] initRemoteWithTCPPort:
8808 host: myHost] autorelease];
NSConnection *connection = [[NSConnection
connectionWithReceivePort: nil sendPort: port] retain];

server = [[connection rootProxy] retain];
[server setProtocolForProxy: @protocol(TestServerProtocol)];
[server addTestClient: self];

if(server == nil)
{
[questionView setString: @"Unable to connect to server. Please
use Host Configuration to set host."];
}
else
{
[questionView setString: @"Please enter your full name, select
a test, and press start. Good Luck!"];
}
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.