Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 连接到socks服务器objective-c_Iphone_Objective C_Ios_Proxy_Socks - Fatal编程技术网

Iphone 连接到socks服务器objective-c

Iphone 连接到socks服务器objective-c,iphone,objective-c,ios,proxy,socks,Iphone,Objective C,Ios,Proxy,Socks,我想连接到我的应用程序中的socks服务器以通过政府筛选 我正在使用这个组件: 一切正常,我可以连接到服务器。 但是NSURLRequest不使用代理 这是我的代码: NSMutableString *strOutput = [NSMutableString stringWithCapacity:1000]; CkoSocket *socket = [[CkoSocket alloc] init]; BOOL success; success = [socket UnlockComponent:

我想连接到我的应用程序中的socks服务器以通过政府筛选

我正在使用这个组件:

一切正常,我可以连接到服务器。 但是NSURLRequest不使用代理

这是我的代码:

NSMutableString *strOutput = [NSMutableString stringWithCapacity:1000];
CkoSocket *socket = [[CkoSocket alloc] init];
BOOL success;
success = [socket UnlockComponent: @"Anything for 30-day trial"];
if (success != YES) {
    [strOutput appendString: socket.LastErrorText];
    [strOutput appendString: @"\n"];
    return;
}

socket.SocksHostname = @"my socks server";
socket.SocksPort = [NSNumber numberWithInt:1080];
socket.SocksUsername = @"user";
socket.SocksPassword = @"pass";
socket.SocksVersion = [NSNumber numberWithInt:5];

success = [socket AsyncConnectStart:@"my socks server" port: [NSNumber numberWithInt: 1080] ssl:NO maxWaitMs: [NSNumber numberWithInt: 20000]];

if (success) {
    NSLog(@"connected");

    NSURLRequest *request = [NSURLRequest requestWithURL:
                             [NSURL URLWithString:@"an image link"]];

    NSOperationQueue *queue = [[NSOperationQueue alloc] init];
    [NSURLConnection sendAsynchronousRequest:request queue:queue  completionHandler:^(NSURLResponse *response,
                                                                                      NSData *data, NSError *error) {
        if ([data length] >0 && error == nil){
            NSLog(@"%@",data);
            img.image=[[UIImage alloc]initWithData:data];
        }

    }];

} else {
    NSLog(@"not connected");
}

socket.MaxReadIdleMs = [NSNumber numberWithInt:10000];
socket.MaxSendIdleMs = [NSNumber numberWithInt:10000];
连接成功,但数据未通过socks服务器