Write stream proxy
Write stream proxy
- Subject: Write stream proxy
- From: Jack Brindle <email@hidden>
- Date: Mon, 08 Sep 2008 13:35:01 -0700
- Thread-topic: Write stream proxy
Title: Write stream proxy
I’m trying to add proxy support to an existing application. The read stream support runs great, but write stream does not.
The app creates a socket pair, then creates a read stream from one socket using CFStreamCreatePairWithSocket. In this call the writestream parameter is NULL. A write stream is then created using the same function, with the read stream parameter null this time. In both cases a run loop is used to allow the responses to be handled through callbacks. The streams communicate with a pair of servers, one which coordinates transfers, and the second to handle them. Things work great without a proxy in the system.
I added proxy support code to the read stream, basing the code on that in the ImageClient8 example. This works great for read streams and downloads, but things break when it is added (with appropriate changes) to the write stream. The proxy issues its challenge, but it is not conveyed through the callback mechanism as it is in the read stream case. The callback handles the cases of kCFStreamEventOpenCompleted, kCF StreamEventCanAcceptBytes and kCFStreamEventErrorOccurred quite well. In fact I am seeing an error reported through the latter, specifically for the domain kCFStreamErrorDomainPOSIX, error id of 32 (broken pipe). At no time do I get any response for the kCFStreamEventHasBytesAvailable case.
This brings up several questions. Should I see anything on the Bytes Available case for write streams? If not, do I need to instantiate a read stream on the socket just to receive challenges? Is it possible the challenges are coming in on the other socket’s read stream? I am definitely not seeing this in that stream’s data.
And, are there any examples for handling proxy through write streams? There are times (like sending files) when a read stream won’t do. I’m sure others have solved this problem.
Any help or suggestions?
Thanks!
Jack Brindle
YouSendIt, Inc.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden