views:

33

answers:

1

Hi everyone,

I'm using CFWriteStreamScheduleWithRunLoop and CFWriteStreamWrite to do asynchronous IO. Here's the question: it seems that only one CFWriteStreamWrite call is safe (free of blocking) per each kCFStreamEventCanAcceptBytes notification, because from the second call, we can't guarantee that the socket is ready to accept more data. So if we want to make n CFWriteStreamWrite calls, we'll have to repeat "waiting for kCFStreamEventCanAcceptBytes" and "calling CFWriteStreamWrite" n times.

Is this correct?
Thanks!

+1  A: 

Same answer as in the other question: call CFWriteStreamCanAcceptBytes() on the stream to see if it's still safe to write on it.

millenomi