Re: Multipart POST using NSInputStream subclass
Re: Multipart POST using NSInputStream subclass
- Subject: Re: Multipart POST using NSInputStream subclass
- From: Quinn <email@hidden>
- Date: Tue, 15 May 2007 17:16:44 +0100
At 10:35 -0500 15/5/07, Dave Dribin wrote:
I found a message on the list from 2005 citing "problems with subclassing
NSInputStream that may prevent it from working":
<http://lists.apple.com/archives/macnetworkprog/2005/Jul/msg00004.html>
Is this still the case?
I believe so.
The DTS incident that Alexey Proskuryakov mentions in this message
(for the record this was <sonr://Request/8628293>) was never
adequately resolved.
A while back I researched this topic independently of the
above-mentioned incident. My conclusion was that it was not possible
to implement an asynchronous stream (that is, a stream that can be
scheduled on the runloop, which is a requirement for any CFNetwork
use) by subclassing NSInputStream without implementing a number of
undocumented methods. _scheduleInCFRunLoop:forMode: is one of these
methods.
Having access to the source (-: I was able to implement these methods
and get my code to work. However, I won't make my code public
because I can't, in good faith, encourage folks to go overriding
undocumented methods.
Thus, your options are:
1. safe but inefficient -- Create a temporary file and using a file stream.
2. more efficient but less safe -- Create a UNIX domain socket pair
and wrap one end in a socket stream. This is less safe because CF
socket streams have only been formally qualified for TCP. I believe
that they work pretty well for UNIX domain sockets, but it's not
something we guarantee.
Curiously, we have no bugs on file (AFAICT) requesting that CF socket
stream formally support UNIX domain sockets, even though it's on
oft-discussed topic on this list. Nor could I find any bugs
requesting a public API for implementing a custom CFStream. OTOH, we
do have a bug requesting that we make NSStream subclasses play nice
with CF (<rdar://problem/3222783>).
S+E
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
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