Skip to content

Instantly share code, notes, and snippets.

@Geri-Borbas
Created June 16, 2013 18:09
Show Gist options
  • Save Geri-Borbas/5792875 to your computer and use it in GitHub Desktop.
Save Geri-Borbas/5792875 to your computer and use it in GitHub Desktop.
if (asynchronous) //The asynchronous way, NOT WORKS (!!!) with IP addresses as host.
{
//Set callback, dispatch callbacks on a background thread.
SCNetworkReachabilitySetCallback(reachabilityRef, reachabilityCallback, &context);
SCNetworkReachabilitySetDispatchQueue(reachabilityRef, dispatch_queue_create("com.eppz.reachability", nil));
}
else //The synchronous way, works well with IP addresses as host.
{
//Get flags.
SCNetworkReachabilityFlags flags;
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
[self.statusView showReachabilityFlags:flags];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment