Re: How to use CFReadStrem and abort read stream normally?
Re: How to use CFReadStrem and abort read stream normally?
- Subject: Re: How to use CFReadStrem and abort read stream normally?
- From: Peter Blazejewicz <email@hidden>
- Date: Tue, 26 May 2009 11:42:22 +0200
Hello Chris,
On May 22, 2009, at 5:10 AM, Chris Gardner wrote:
Hi,
I have already read through CFReadStream archives, and still have
trouble with it.
After CFReadStreamOpen() has been implement and its status is
kCFStreamEventHasBytesAvailable,
so I can read data from the source.Of course, there's no problem. As
for the FTP server,
I can connect it by using CFReadStreamCreateWithFTPURL.
Now, I would like to abort/disconnect the read stream when its
status is kCFStreamEventHasBytesAvailable.
At that time. I will use CFReadStreamClose() and CFRunLoopStop().
As you know, the read stream was availabe in a run loop
where data stream can tranfer from FTP server to destination.
However, I met a terrible problem which show GDB:Program received
signal:"EXC_BAD_ACCESS" as soon as I do above operation,
also I see the read stream's status become
kCFStreamEventErrorOccurred.
So my question is...How can I avoid this error and how can I abort
the read stream normally
when its status is kCFStreamEventHasBytesAvailable.
Your help will be appreciated.
Best Regards.
Chris Wu
have you tried using routine described in docs (unschedule from run
loop and close stream)?
http://developer.apple.com/documentation/Networking/Conceptual/CFNetwork/CFStreamTasks/CFStreamTasks.html#/
/apple_ref/doc/uid/TP30000230-62233
e.g.:
CFReadStreamUnscheduleFromRunLoop(myStream, CFRunLoopGetCurrent(),
kCFRunLoopCommonModes);
CFReadStreamClose(myStream);
CFRelease(myStream);
kind regards,
Peter Blazejewicz
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden