2

政府のフィルタリングを通過するために、アプリでソックス サーバーに接続したいと考えています。

このコンポーネントを使用しています: Chilkat Socket/SSL/TLS component/library

すべて問題なく、サーバーに接続できます。しかし、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];

接続は成功しましたが、データがソックス サーバーを通過していません。

4

0 に答える 0