Hello,
In this stream, I want to communicate using our proprietary protocol, based on TCP and SSL.
For some reason, I cannot connect to the server.
In the WireShark I see, that the client does not try to connect to proxy, but tries to connect to server directly.
The question is: if I can use this solution to communicate via Proxy for TCP-based stream?
Does somebody have any experience with this solution (preferably for TCP stream, not HTTP/HTTPS)? If yes, maybe something wrong in my code? (see below)
Thanks a lot,
Yulia
This is the code I try to run:
CFReadStreamRef readStream =
NULL;
CFWriteStreamRef writeStream =
NULL;
::CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault,
(__bridge
CFStringRef)hostAddress, portNum, &readStream, &writeStream);
::CFWriteStreamSetProperty(writeStream,
kCFStreamPropertyShouldCloseNativeSocket,
kCFBooleanTrue);
::CFReadStreamSetProperty(readStream,
kCFStreamPropertyShouldCloseNativeSocket,
kCFBooleanTrue);
CFDictionaryRef proxyDict = ::SCDynamicStoreCopyProxies(NULL);
::CFReadStreamSetProperty(readStream,
kCFStreamPropertyHTTPProxy, proxyDict);
[readStream scheduleInRunLoop:[NSRunLoop
currentRunLoop]
forMode:NSDefaultRunLoopMode];
[writeStream scheduleInRunLoop:[NSRunLoop
currentRunLoop]
forMode:NSDefaultRunLoopMode];
[readStream open];
[writeStream open];
I also tried to build the proxy dictionary in the code with the proxy name or IP, but it did not help.
|