समारोह है कि आप सभी प्रॉक्सी जानकारी SCDynamicStoreCopyProxies(), यह नीचे दिए गए उदाहरण में के रूप में कहा जा सकता है है देता होते हैं (संपन्न कर लिए जाने आप भी CFRelease
करने के लिए है इन वस्तुओं के सभी, क्योंकि वे सभी सीएफ से और नहीं सीधे कोको वस्तुओं) कर रहे हैं:
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
int main(int argc, const char * argv[])
{
@autoreleasepool {
CFDictionaryRef proxies = SCDynamicStoreCopyProxies(NULL);
CFIndex count = CFDictionaryGetCount(proxies);
NSLog(@"Number of keys is %ld", count);
NSDictionary * proxyConfiguration = (NSDictionary*) proxies;
for (id key in proxyConfiguration.keyEnumerator) {
NSLog(@"Pair is %@ -> %@", key, [proxyConfiguration valueForKey: key]);
}
}
return 0;
}
और उत्पादन होगा कुछ की तरह:
2012-11-07 16:33:57.844 network-test[6501:403] Number of keys is 12
2012-11-07 16:33:57.847 network-test[6501:403] Pair is HTTPEnable -> 1
2012-11-07 16:33:57.848 network-test[6501:403] Pair is HTTPSProxy -> 127.0.0.1
2012-11-07 16:33:57.848 network-test[6501:403] Pair is ExceptionsList -> (
"www.google.com"
)
2012-11-07 16:33:57.849 network-test[6501:403] Pair is HTTPSPort -> 8888
2012-11-07 16:33:57.850 network-test[6501:403] Pair is __SCOPED__ -> {
en1 = {
ExceptionsList = (
"www.google.com"
);
FTPPassive = 1;
HTTPEnable = 1;
HTTPPort = 8888;
HTTPProxy = "127.0.0.1";
HTTPSEnable = 1;
HTTPSPort = 8888;
HTTPSProxy = "127.0.0.1";
SOCKSEnable = 1;
SOCKSPort = 8889;
SOCKSProxy = "127.0.0.1";
};
}
2012-11-07 16:33:57.850 network-test[6501:403] Pair is HTTPProxy -> 127.0.0.1
2012-11-07 16:33:57.851 network-test[6501:403] Pair is SOCKSPort -> 8889
2012-11-07 16:33:57.852 network-test[6501:403] Pair is SOCKSProxy -> 127.0.0.1
2012-11-07 16:33:57.852 network-test[6501:403] Pair is HTTPSEnable -> 1
2012-11-07 16:33:57.853 network-test[6501:403] Pair is SOCKSEnable -> 1
2012-11-07 16:33:57.853 network-test[6501:403] Pair is HTTPPort -> 8888
2012-11-07 16:33:57.854 network-test[6501:403] Pair is FTPPassive -> 1
स्रोत
2012-11-07 22:04:07
लिंक का पालन भी की जाँच करें: http://stackoverflow.com/questions/4379156/retrieve-pac-script-using-wpad-on-osx सादर, आनंद चौबे –