On Aug 24, 2008, at 11:54 AM, Ben Einstein wrote:

I have multiple DO connections to a "client" system over the LAN (technically, each of 4 systems is a server, but it doesn't much matter). The 4 systems check to ensure my system is alive by "pinging" it every few seconds with a simple - (BOOL)clientIsThere method. This ping routine runs in a separate runloop on the servers. Everything works great.

Now, if I press and hold a button (say, a popup button or any menu item) for more than the DO timeout, the servers don't get a response, and disconnect themselves. So users that aren't necessarily sure of what they're doing and need to look around for a bit, will loose their connections. I think the answer to this problem is to somehow put the client objects in a different thread, but I'm not sure how to do that.

Has anyone else had this problem? Is there an easy fix?

There are at least two possible approaches:

You can create the NSConnection on a secondary thread so it is scheduled in that thread's run loop. Then, leave that thread running its run loop. The problem is that you then have to deal with requests being handled on this secondary thread.

You can use -[NSConnection addRequestMode:] to add the NSEventTrackingRunLoopMode, which is the mode being used while a button is held down. The problem here is that you have to deal with requests being handled during event tracking, which might be awkward depending on the nature of the request.

Cheers,
Ken
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to