Good network reachability testing
I'm having a really hard time getting good network connecting checking in an application. It is an audio stream player, so I need to be alerted pretty quickly about changes in network connection, and I've already tried the apple reachability sample code, but it doesn't seem to always work (specifically I don't think I've enabled the notifications right).
It works ok when starting up if the WiFi is turned off (error appears quickly and all), but if the connection drops it will hang and crash (it appears to never get the notification). I've tried implimenting reachability checks at every major point of the app and it still doesn't seem to work. I should note that it fails the worst when I just unplug the internet from the router and not the router itself. It takes a full minute sometimes to realize the server stopped responding (at least until I get notified of it).
All in all my current model sucks and I'd really appreciate help in how to work in good network checking. The only real requirement is it be able to alert me when the network drops so I can take action to shut down the stream and stream info updater. Realizing the connection is back and restarting the stream is a plus but I'll settle for anything that works at this point. Thanks!
|