Get host name and port(Object-c)
/**************************************************************************
@param pChHostName: [output]Get system proxy host name
@param pChPort: [output]Get system proxy port
@param iProxyType:[input]ProxyType: 1(HTTP);2(HTTPS);....
**************************************************************************/
bool MacGetProxyHostNameAndPort(int iProxyType, char *pChHostName, char *pChPort)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; bool bRet = false;
NSDictionary *proxyConfiguration = NSMakeCollectable([(NSDictionary*) SCDynamicStoreCopyProxies(NULL) autorelease]); if (!proxyConfiguration)
{
[pool release];
return bRet;
} //Init proxy type
NSString *nsStrProxyEnable = nil;
NSString *nsStrProxyHostName = nil;
NSString *nsStrProxyPort = nil;
if ( == iProxyType)
{
nsStrProxyEnable = (NSString*)[proxyConfiguration objectForKey:@"HTTPSEnable"];
nsStrProxyHostName = (NSString*)[proxyConfiguration objectForKey:@"HTTPSProxy"];
nsStrProxyPort = [NSString stringWithFormat:@"%d", [[proxyConfiguration objectForKey:@"HTTPSPort"] intValue]];
}
else
{
nsStrProxyEnable = (NSString*)[proxyConfiguration objectForKey:@"HTTPEnable"];
nsStrProxyHostName = (NSString*)[proxyConfiguration objectForKey:@"HTTPProxy"];
nsStrProxyPort = [NSString stringWithFormat:@"%d", [[proxyConfiguration objectForKey:@"HTTPPort"] intValue]];
} int iProxyEnable = [nsStrProxyEnable intValue];
if ( == iProxyEnable)
{
const char *pHostName = [nsStrProxyHostName UTF8String];
int iLen = [nsStrProxyHostName length];
memset(pChHostName, , );
memcpy(pChHostName, pHostName, iLen); const char *pPort = [nsStrProxyPort UTF8String];
iLen = [nsStrProxyPort length];
memset(pChPort, , );
memcpy(pChPort, pPort, iLen);
bRet = true;
} [pool drain];
return bRet;
}
Get host name and port(Object-c)的更多相关文章
- Could not connect to SMTP host: smtp.***.com, port: 465, response: -1
背景 在使用javamail进行邮件发送的时候,报错: Could not connect to SMTP host: smtp.***.com, port: 465, response: -1 原因 ...
- GitHub上传不了的解决 ssh: connect to host github.com port 22: Bad file number git did not exit cleanly (exit code 128)
问题情况 本来一直用的是github的客户端,结果现在上传的时候出问题了,去网站上看,新项目已经创建,但是代码却怎么都上传不上去.于是只好用命令行的方式解决. Tortoisegit上是这样说的: g ...
- ssh: connect to host github.com port 22: Connection refused
假设git例如,下面的问题时,远程推送: [fulinux@ubuntu learngit]$ git push -u origin master ssh: connect to host githu ...
- windows环境pip安装时一直报错Could not fetch URL https://pypi.org/simple/xrld/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url:
最近项目不忙了~~有开始专研的python大业,上来想用pip安装一个第三方的库,就一直报错: Could not fetch URL https://pypi.org/simple/xrld/: T ...
- ssh: connect to host github.com port 22: Connection timed out
问题描述 $ git clone git@github.com:MaugerWu/MaugerWu.github.io.git Cloning into 'MaugerWu.github.io'... ...
- Github拉取远端的时候提示“ssh: connect to host github.com port 22: Connection timed out”错误
在使用Github的时候,如果使用到拉取远端分支的时候或者测试ssh -T git@github.com的时候可能会出现连接失败的问题,错误描述为“ssh: connect to host githu ...
- git clone遇到的[ssh: connect to host github.com port 22]
起因 在学习递归的时候,对汉诺塔小研究了一番,参考网上写了个demo,后面就想同步到github. 过程 这台电脑是新电脑,所以需要先本地生成ssh key:ssh-keygen -t rsa -C ...
- github连接报"ssh: connect to host github.com port 22: Connection timed out"错误
1. 异常 在连接github时,执行"ssh -T git@github.com" 命令时,出现 ssh: connect to host github.com port 22: ...
- github默认端口22被占用,ssh: connect to host github.com port 22: Connection timed out
出现github 连接错误: ssh:connect to host github.com port 22:Connection timed out 刚开始以为是网络问题,github不能连接上,但是 ...
- 关于github报错:ssh: connect to host github.com port 22: Connection timed outfatal: Could not read from remote repository.Please make sure you have the correct access rightsand the repository exists.
当执行git命令如:git clone.git pull等等 出现报错:ssh: connect to host github.com port 22: Connection timed outfat ...
随机推荐
- Java jvm级别native关键词、JNI详解
1.native关键词的引入 再完美的编程语言也有自己的不足之处,当然Java也不例外,Java的不足之处除了体现在运行速度(这点往往被一些其他编程语言使用者所诟病)上要比传统的C++慢许多之外,Ja ...
- 第二章:2.9 总结一下 Django
1. URLconf(URL configuration ) : 这个模块包含URL模式(正则表达式)到视图函数(view.py)的简单映射. 2. python 正则表达式: 解释: 通配符:r : ...
- JavaScript一个生成文档目录的实例
执行结果: <body> <script type="text/javascript"> /** * 这个模块注册一个可在页面加载完成后自动运行的匿名函数, ...
- [基础架构]PeopleSoft工作原理(从浏览器发送请求开始)
PeopleSoft体系结构是由几大组成部分构成,之前文章已经详细讲过,了解这几大组成部分是怎么协同工作的更为重要.在本文中将帮助您了解PeopleSoft的工作原理以及用户发送的请求是如何被解析以及 ...
- php之试触法----error--关键字的误用
实际开发中,在不同网页的输出中,常常有许多公共的代码或者变量需要使用,于是定义了以下类来缩减代码量 如下代码所示: <?php class universalClass { function w ...
- 20170711_map/reduce
js: map: var arr = [1,2,3,4,5]; var res = arr.map(function(x){ return x * x; }); //res 现在 = [1,4,9,1 ...
- 使用travis-ci自动部署github上的项目
travis-ci是什么? 一个使用yaml格式配置用于持续集成完成自动化测试部署的开源项目 官网:https://travis-ci.org/ 使用travis-ci集成vue.js项目 首先,您需 ...
- Java虚拟机--垃圾收集
Java虚拟机 1. JVM运行时数据区域 参考书籍:<深入理解Java虚拟机:JVM高级特性与最佳实践,第二版> 资料参考:http://blog.csdn.net/nms312/art ...
- linux服务器部署jar包以及shell脚本的书写
背景:记录在linux环境下部署jar程序的过程 1 部署过程记录 1.1 程序结构 这里的main函数就在DemRest2.java 文件中. 为了部署方便,要做到以下两点: 1 在导出的jar包中 ...
- Apache Flume 1.7.0 各个模块简介
Flume简介 Apache Flume是一个分布式.可靠.高可用的日志收集系统,支持各种各样的数据来源,如http,log文件,jms,监听端口数据等等,能将这些数据源的海量日志数据进行高效收集.聚 ...