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
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (Macnetworkprog@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/macnetworkprog/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to