Re: Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop

2009-10-02 Thread jonat...@mugginsoft.com
On 2 Oct 2009, at 20:50, Jens Alfke wrote: On Oct 2, 2009, at 2:50 AM, jonat...@mugginsoft.com wrote: Seems that by the time I get the IOKit sleep notification my Bonjour service has already disconnected so my packets end up going nowhere anyway. How exactly is your Bonjour service impl

Re: Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop

2009-10-02 Thread Jens Alfke
On Oct 2, 2009, at 2:50 AM, jonat...@mugginsoft.com wrote: Seems that by the time I get the IOKit sleep notification my Bonjour service has already disconnected so my packets end up going nowhere anyway. How exactly is your Bonjour service implemented? Bonjour itself only does service di

Re: Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop

2009-10-02 Thread jonat...@mugginsoft.com
On 1 Oct 2009, at 22:09, Jens Alfke wrote: On Sep 30, 2009, at 1:32 PM, jonat...@mugginsoft.com wrote: I intend to send off my bit of data, hang around ( <= 30 secs) to get notification and then close everything. Why do you need to wait at all? —Jens Sorry the slow response. My app us

Re: Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop

2009-10-01 Thread Jens Alfke
On Sep 30, 2009, at 1:32 PM, jonat...@mugginsoft.com wrote: I intend to send off my bit of data, hang around ( <= 30 secs) to get notification and then close everything. Why do you need to wait at all? —Jens___ Cocoa-dev mailing list (Cocoa-dev@l

Re: Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop

2009-09-30 Thread jonat...@mugginsoft.com
Not sure though that having called IOCancelPowerChange(,) wether it can be revoked before the 30 secs are up. Perhaps a call to IOAllowPowerChange() will be effective. The above is garbled nonsense . I can achieve the desired goal by NOT calling either IOCancelPowerChange() or IOAllowPowe

Re: Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop

2009-09-30 Thread jonat...@mugginsoft.com
On 30 Sep 2009, at 20:57, Jens Alfke wrote: On Sep 30, 2009, at 9:59 AM, jonat...@mugginsoft.com wrote: Before entering sleep I would like to send small amounts of data via async instances of CFSocket to the local and some remote hosts. It's usually best to close open sockets entirely bef

Re: Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop

2009-09-30 Thread Jens Alfke
On Sep 30, 2009, at 9:59 AM, jonat...@mugginsoft.com wrote: Before entering sleep I would like to send small amounts of data via async instances of CFSocket to the local and some remote hosts. It's usually best to close open sockets entirely before going to sleep. The socket might not work

Re: Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop

2009-09-30 Thread Jeff Johnson
If by 'finagle' you mean 'run', then yes, that should work. ;-) There's a little bit more detail here: http://developer.apple.com/mac/library/qa/qa2004/qa1340.html -Jeff On Sep 30, 2009, at 11:59 AM, jonat...@mugginsoft.com wrote: Before entering sleep I would like to send small amounts of d

Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop

2009-09-30 Thread jonathan
Before entering sleep I would like to send small amounts of data via async instances of CFSocket to the local and some remote hosts. So I register for the sleep notification: [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver: self selector: @selector(appWillSleep:) nam