• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How SCNetworkReachability works with proxy and no DNS resolving?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How SCNetworkReachability works with proxy and no DNS resolving?


  • Subject: Re: How SCNetworkReachability works with proxy and no DNS resolving?
  • From: Josh Graessley <email@hidden>
  • Date: Mon, 23 May 2016 08:44:25 -0700

There were some pretty substantial changes made to the way SCNetworkReachability works under the covers in 10.11 to address issues like this. The solution that Jens provided is a pretty good approximation for older systems.

If you do add smarts to handle proxies with reachability, it may be wise to only use it prior to 10.11.

-josh

> On May 23, 2016, at 5:12 AM, Yulia Bensman <email@hidden> wrote:
>
> Thanks for everyone,
> But maybe – if it works correct in 10.11, maybe there is any means to make it working in other versions of Mac OS?
>
> From: Jens Alfke [mailto:email@hidden]
> Sent: Sunday, May 22, 2016 6:51 PM
> To: Yulia Bensman
> Cc: email@hidden
> Subject: Re: How SCNetworkReachability works with proxy and no DNS resolving?
>
> In my code, I check whether the server’s address requires a proxy. If so, I use the reachability API only to check whether an Internet connection is available, and then try to connect.
>
> Here’s the code I use to check for a proxy:
>
> + (BOOL) usingProxyForURL: (NSURL*)url {
>     NSDictionary* settings = CFBridgingRelease(CFNetworkCopySystemProxySettings());
>     NSArray* proxies = CFBridgingRelease(CFNetworkCopyProxiesForURL((__bridge CFURLRef)url,
>                                                                     (__bridge CFDictionaryRef)settings));
>     for (NSDictionary* proxy in proxies) {
>         if (![proxy[(id)kCFProxyTypeKey] isEqual: (id)kCFProxyTypeNone])
>             return YES;
>     }
>     return NO;
> }
>
>
> —Jens
>
>
>
>
> ************************************************************************************
> This footnote confirms that this email message has been scanned by
> PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses.
> ************************************************************************************
>
> =
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Macnetworkprog mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: How SCNetworkReachability works with proxy and no DNS resolving?
      • From: Jens Alfke <email@hidden>
References: 
 >How SCNetworkReachability works with proxy and no DNS resolving? (From: Yulia Bensman <email@hidden>)
 >Re: How SCNetworkReachability works with proxy and no DNS resolving? (From: Jens Alfke <email@hidden>)
 >RE: How SCNetworkReachability works with proxy and no DNS resolving? (From: Yulia Bensman <email@hidden>)

  • Prev by Date: RE: How SCNetworkReachability works with proxy and no DNS resolving?
  • Next by Date: Re: How SCNetworkReachability works with proxy and no DNS resolving?
  • Previous by thread: RE: How SCNetworkReachability works with proxy and no DNS resolving?
  • Next by thread: Re: How SCNetworkReachability works with proxy and no DNS resolving?
  • Index(es):
    • Date
    • Thread