how to detect network event in cocoa osx
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.
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.
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/
精彩评论