Re: Does CFWriteStream coalesce writes?
Re: Does CFWriteStream coalesce writes?
- Subject: Re: Does CFWriteStream coalesce writes?
- From: Jens Alfke <email@hidden>
- Date: Thu, 29 May 2008 11:57:51 -0700
On 29 May '08, at 11:36 AM, Mark Pauley wrote:
Nope, we don't buffer in CFSocketStreamWrite. You might want to
take a look at a tcp dump to see just how many bytes per packet
you're sending... I would imagine this is a place where we could
improve, (signalling canAcceptBytes is probably expensive, as is
sending short packets).
Thanks. The issue is that the data to be sent is spread out in
multiple locations: I'm multiplexing segments of messages together,
each message is in its own buffer, and each segment has to be prefixed
with a short header. I don't want to have to copy everything into a
single buffer and then make one -write: call.
But if I make multiple write calls in a row, subsequent ones will
block if the stream runs out of write space. (Is that a bug?) It seems
I'd have to call -hasSpaceAvailable before each call, to preflight.
The ideal call to use would be writev. I'm not sure whether it's safe
to combine this with CFStream, however. I know how to extract the file
descriptor from the stream, but if I write directly to it am I liable
to confuse the stream's internal state?
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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