/**************************************************************************
@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)的更多相关文章

  1. 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 原因 ...

  2. GitHub上传不了的解决 ssh: connect to host github.com port 22: Bad file number git did not exit cleanly (exit code 128)

    问题情况 本来一直用的是github的客户端,结果现在上传的时候出问题了,去网站上看,新项目已经创建,但是代码却怎么都上传不上去.于是只好用命令行的方式解决. Tortoisegit上是这样说的: g ...

  3. ssh: connect to host github.com port 22: Connection refused

    假设git例如,下面的问题时,远程推送: [fulinux@ubuntu learngit]$ git push -u origin master ssh: connect to host githu ...

  4. 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 ...

  5. 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'... ...

  6. Github拉取远端的时候提示“ssh: connect to host github.com port 22: Connection timed out”错误

    在使用Github的时候,如果使用到拉取远端分支的时候或者测试ssh -T git@github.com的时候可能会出现连接失败的问题,错误描述为“ssh: connect to host githu ...

  7. git clone遇到的[ssh: connect to host github.com port 22]

    起因 在学习递归的时候,对汉诺塔小研究了一番,参考网上写了个demo,后面就想同步到github. 过程 这台电脑是新电脑,所以需要先本地生成ssh key:ssh-keygen -t rsa -C ...

  8. 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: ...

  9. 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不能连接上,但是 ...

  10. 关于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 ...

随机推荐

  1. 用py2exe将python文件转换成exe可执行程序

    1.首先需要安装py2exe模块,下载地址:http://www.lfd.uci.edu/~gohlke/pythonlibs/ 然后用pip install 命令安装py2exe模块,如果你用的py ...

  2. window.onload的使用心得

    如果我问你window.onload是什么意思,恐怕你会回答我:"这不是页面加载完就执行吗".  但是答案是不一定,得看你怎么用.看一下例子吧 例1:  代码如下:   <! ...

  3. (转载)Jython 简单入门

    转载链接:http://willzh.iteye.com/blog/307222 1. 用Jython调用Java类库 第一步.创建Java类 写一个简单的Java类,用Point来示例: impor ...

  4. NewsDao

    package com.pb.news.dao; import java.util.Date;import java.util.List; import com.pb.news.entity.News ...

  5. usaco 2008 月赛 lites 开关灯 题解

      题目:     Farmer John尝试通过和奶牛们玩益智玩具来保持他的奶牛们思维敏捷. 其中一个大型玩具是 牛栏中的灯. N (2 <= N <= 100,000) 头奶牛中的每一 ...

  6. python学习笔记——列表操作

    python列表操作——增 append:追加一条数据到列表的最后 name = ["Zhangsan","XiongDa","Lisi"] ...

  7. 【前端】用jQuery实现瀑布流效果

    jQuery实现瀑布流效果 何为瀑布流: 瀑布流,又称瀑布流式布局.是比较流行的一种网站页面布局,视觉表现为参差不齐的多栏布局,随着页面滚动条向下滚动,这种布局还会不断加载数据块并附加至当前尾部.最早 ...

  8. Sql 2008R2 windows身份好用 ,sa身份不好用

    Sql server2008r2 安装完毕以后 windows身份验证好用,sa身份不好用,解决方法步骤如下: 1.首先用windows身份登录 2.SQL实例右键属性 3.安全性这一项 4.选择wi ...

  9. GET请求和POST请求的区别

    request获取请求参数 最为常见的客户端传递参数方式有两种: 浏览器地址栏直接输入:一定是GET请求: 超链接:一定是GET请求: 表单:可以是GET,也可以是POST,这取决与<form& ...

  10. Python--my first try!

    我所用的编译器是:Python 3.6.0 我之所以在一开始就说我的编译器是因为不同的编译器,不同的版本在代码的写法上会有一些区别! 比如:在我所用的版本3中print的用法是Print (" ...