Is there any way to be notif开发者_StackOverflowied / have your Cocoa application listen for changes in the network connection (disconnect, connect, etc.)? How does something like HardwareGrowler do it?
After looking at the source code for HardwareGrowler (found under /Extras
in the source code for Growl, I figure that the easiest way would be to use the NetworkNotifier.m
class and change all calls to AppDelegate
functions to whatever callbacks you want executed when the network connection changes (and give them credit for their code!).
精彩评论