views:

142

answers:

2

Is it possible to make sure my thread reacts on whenever there is network available ? Basically my thread should automatically get event that network is available and perform certain task.

Any help will be appreciated.

+1  A: 

Yes you can, use Reachability APIs in SystemConfiguration.framework. See here. A sample code (for iphone) is available here. The parts concerning the reachability APIs should be usable for OS X, too.

To use the APIs, you need to understand an OS X specific concept of "run loops." See here.

Yuji
I wanted asynchronous way of receiving notification of network change event.
Unicorn
A: 

I found a way of getting network change event using growl framework. Added code on top of it to receive network change event. Growl framework can be found at http://growl.info/documentation/developer/

Unicorn