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: Chris Gardner <email@hidden>
- Date: Tue, 26 May 2009 19:04:14 +0800
- Importance: Normal
Hi peter,
I have read the docs ,and when stopping the read stream, I do use the functions, as your said,below
CFReadStreamUnscheduleFromRunLoop(myStream, CFRunLoopGetCurrent(), kCFRunLoopCommonModes);
CFReadStreamClose(myStream);
CFRelease(myStream);
According to the docs, it can be safely stop the read stream,
and it's supposed to continue downloading the same file if I have created a new read stream
to download the same file.But it disappointed me.
If you have any other suggestions, please inform me.
Best Regards,
Chris
CC: email@hidden
From: email@hidden
To: email@hidden
Subject: Re: How to use CFReadStrem and abort read stream normally?
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-62233e.g.:CFReadStreamUnscheduleFromRunLoop(myStream, CFRunLoopGetCurrent(), kCFRunLoopCommonModes);CFReadStreamClose(myStream);
CFRelease(myStream);
kind regards,Peter Blazejewicz
_________________________________________________________________
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.
http://www.microsoft.com/windows/windowslive/products/photos.aspx_______________________________________________
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