Re: not receiving kCFStreamEventCanAcceptBytes
Re: not receiving kCFStreamEventCanAcceptBytes
- Subject: Re: not receiving kCFStreamEventCanAcceptBytes
- From: Matthew Rushton <email@hidden>
- Date: Thu, 16 Oct 2008 11:37:27 -0700 (PDT)
So I think I know the issue now but still don't fully understand it. It seems I need to call:
CFRunLoopWakeUp(CFRunLoopGetCurrent())
after writing to my write stream (I'm writing from outside the callback in this case). Is this normal? I expected the run loop to get woken up for me. Here's how I create them:
//set write stream client
CFWriteStreamSetClient(writeStream, kCFStreamEventOpenCompleted | kCFStreamEventCanAcceptBytes | kCFStreamEventErrorOccurred | kCFStreamEventEndEncountered, writeStreamCallback, &clientContext);
if (err == FALSE)
{
NSLog(@"error: unable to set write stream client");
return -1;
}
//attach write stream to run loop
CFWriteStreamScheduleWithRunLoop(writeStream, CFRunLoopGetCurrent(), kCFRunLoopCommonModes);
-Matt
--- On Thu, 10/16/08, Matthew Rushton <email@hidden> wrote:
> From: Matthew Rushton <email@hidden>
> Subject: not receiving kCFStreamEventCanAcceptBytes
> To: email@hidden
> Date: Thursday, October 16, 2008, 2:00 PM
> Hi,
> This is my first post, I searched the list and docs with
> no luck for help. I'm writing a single threaded app that
> uses CFNetwork and callbacks for network communication. At
> all times I keep track of whether I can write to my stream
> by tracking kCFStreamEventCanAcceptBytes messages. I expect
> to receive one after each write I do to alert me I can write
> again. The problem is I've seemed to hit a case where I
> do a write and never get a message which of course stalls
> all communication. If I write anyway the write succeeds. My
> question is should I expect a message after each write? What
> if I write outside of my callback function, will I receive
> messages then? What could cause these messages to simply
> stop being sent despite everything else to appear fine?
> Thanks in advance.
> -Matt
>
>
>
> _______________________________________________
> 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
_______________________________________________
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