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 ...
随机推荐
- android源码 分享1
技术博客 "碎片化"严重,安卓走向封闭?[Bus Weekly]48期 阅读数:286 2017-05-08 按照NetMarketShare统计数据显示, ...
- 第二章:2.9 总结一下 Django
1. URLconf(URL configuration ) : 这个模块包含URL模式(正则表达式)到视图函数(view.py)的简单映射. 2. python 正则表达式: 解释: 通配符:r : ...
- Host 'hello-PC' is not allowed to connect to this MySQL server远程连接mysql授权
问题:"Host 'admin-PC' is not allowed to connect to this MySQLserver" (其中,admin-PC为我的机器名) 原 ...
- 基于vue2.0的一个豆瓣电影App
1.搭建项目框架 使用vue-cli 没安装的需要先安装 npm intall -g vue-cli 使用vue-cli生成项目框架 vue init webpack-simple vue-movie ...
- MySQL学习笔记(三)
--回顾 字段类型(列类型):数值型,时间日期型和字符串类型 数值型:整型和小数型(浮点型和定点型) 时间日期型:datetime,date,time,timestamp,year 字符串类型:定长, ...
- raft如何实现Linearizable Read
Linearizable Read通俗来讲,就是读请求需要读到最新的已经commit的数据,不会读到老数据. 对于使用raft协议来保证多副本强一致的系统中,读写请求都可以通过走一次raft协议来满足 ...
- C语言学习随笔
前段时间我们学习了HTML,感觉自己不在状态,后来就开始怀疑自己的智商呢!现在C语言也到了尾声,在这20天的学习过程中,我没 有以前那么的傲娇了. 我开始慢慢去反省自己,自己究竟该如何去学习,都说勤能 ...
- 在Docker Hub上查找可用的Image映像
任何人都可以创建Docker Image映像,你可以浏览Docker Hub来查找这些Image映像. 定位Whalesay 映像 打开你的浏览器,浏览Docker Hub: Docker Hub包含 ...
- 如何删除svn标签
SVN是Subversion的简称,是一个开放源代码的版本控制系统,对于多人共同开发同一个项目非常有用,但有一点比较让人头疼,那就是项目移植的时候,原来的文件夹带有很多可恶的svn标签,使其不能add ...
- Spring Boot 使用Redis缓存
本文示例源码,请看这里 Spring Cache的官方文档,请看这里 缓存存储 Spring 提供了很多缓存管理器,例如: SimpleCacheManager EhCacheCacheManager ...