Re: DistantObject, NSConnection, NSPortCoder Exception
Re: DistantObject, NSConnection, NSPortCoder Exception
- Subject: Re: DistantObject, NSConnection, NSPortCoder Exception
- From: Guy Meyer <email@hidden>
- Date: Wed, 12 Sep 2007 01:11:00 +0300
On 9/11/07, Richard Salvatierra wrote:
I can not catch a "[NSPortCoder sendBeforeTime:sendReplyPort:]
timed out" exception and gracefully handle it. I have a sample app
in Master (server) mode on one computer and Slave (clients) mode on
another machine(s) over a local network. I have the app randomly
disconnect (turn client off) and/or crash (to simulate network
problems) because I want the Master to be able to recover and re-
connect after a problem.
My app (in Master / server mode) crashes when this exception occurs.
For those interested I have posted the sample app.
http://homepage.mac.com/richsal/FileSharing7.html
Thanks for any help,
-Rich
In order for the Master (as you call it) to recover and reconnect,
register for NSPortDidBecomeInvalidNotification notification
( ([[NSNotificationCenter defaultCenter] addObserver: ...]) , it will
inform you when the connection is lost.
In addition when dispatching commands between the server and the
client use @try {} @catch (id theException) {}, thus you will be
informed if the DO communication fails and will prevent exceptions
crash, there is no need to try catching NSPortCoder, set the send/
reply timeout as desired.
Guy
_______________________________________________
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