NSStream and CFStream
NSStream and CFStream
- Subject: NSStream and CFStream
- From: Frederick Cheung <email@hidden>
- Date: Thu, 18 Nov 2004 00:29:06 +0000
I don't supposed there's any chance that NSStream and CFStream are toll
free bridged? They're not listed on the "interchangeable data types" in
the integrating carbon and cocoa document, but neither is
DRBurn*/DRBurnRef and they are bridged as of 10.3, and there certainly
seems to be a 1-1 mapping between methods/functions. They reason i ask
is that I am using cfhttp to post files. I'm using
CFReadStreamCreateForStreamedRequest. It is sometimes the case that i
want to manipulate the data before it is sent, and typically the data
will be large enough I don't want to hold it in memory.
If i was in cocoa land, I believe I could do this by subclassing
NSInputStream and implementing by own read:maxlength: method that would
call super, do something to the data and then return that. Obviously in
carbon land this cannot be done, and I see no mechanism for creating my
own types of CFReadStream. My application mixes cocoa and carbon fairly
liberally, so it would be feasible to switch to a cocoa solution
throughout, although i;d rather not since i am more familiar with
cfnetwork (and also i cannot see an equivalent of
CFReadStreamCreateForStreamedRequest in NSMutableURLRequest, although I
may need to more searching).
One thought that has occured to me is that, perhaps i could take my
file, create a pair of unix domain sockets, read the file with my api
of my choice writing it to a unix domain socket, and use
CFStreamCreatePairWithSocket on the other socket of the pair to get a
cfreadstream. I'd insert my custom processing between reading the data
from the file and writing it to the socket. However I don't really know
enough about sockets and all to say whether this would work. It seems a
little convoluted, but if it works ok it would be better than nothing.
Does this sound a sensible idea or am I overlooking a glaring flaw?
Fred
_______________________________________________
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