Hello,
I am trying to implement connection via Proxy using the way recommended for
CFStream in “Working with Streams” chapter
(https://developer.apple.com/library/mac/documentation/Networking/Conceptual/CFNetwork/CFStreamTasks/CFStreamTasks.html)
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.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/macnetworkprog/archive%40mail-archive.com
This email sent to [email protected]