Welcome to MacForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

A problem with FTP programing with CFWriteStream.

 
   Macintosh computer (Home) -> Programmer Help RSS
Next:  iTunes on PC/iPod nano question  
Author Message
Mopelee

External


Since: Mar 30, 2006
Posts: 6



(Msg. 1) Posted: Fri Apr 28, 2006 6:22 pm
Post subject: A problem with FTP programing with CFWriteStream.
Archived from groups: comp>sys>mac>programmer>help (more info?)

Hi, everyone:

I use CFReadStreamCreateWithFTPURL function to create a
CFWriteStream,so that i can upload file to ftp server.
But,the is a problem,when i call CFWriteStreamWrite function to
update bytes to ftp server.because it will not block, so when i call
call CFWriteStreamClose to close the Stream after call
CFWriteStreamWrite. I found that some bytes haven't tranfer to ftp
server yet,so i got a error on ftp server with the file, it is smaller
than the file upload by me.


Could anybody know how to deal with this problem? by the way i'm not
using callback method wich recomand by apple, because it doesn't fit
with my class.


thx.

 >> Stay informed about: A problem with FTP programing with CFWriteStream. 
Back to top
Login to vote
Mopelee

External


Since: Mar 30, 2006
Posts: 6



(Msg. 2) Posted: Fri Apr 28, 2006 7:16 pm
Post subject: Re: A problem with FTP programing with CFWriteStream. [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

all about what i say is means is there any way, which i can test a
CFWriteStream is finish transfer data to remote ftp server, so that i
can release it safely. but it not using event

 >> Stay informed about: A problem with FTP programing with CFWriteStream. 
Back to top
Login to vote
Mopelee

External


Since: Mar 30, 2006
Posts: 6



(Msg. 3) Posted: Fri Apr 28, 2006 8:07 pm
Post subject: Re: A problem with FTP programing with CFWriteStream. [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Michael Ash :
thank u very much. may i know is there any function can polling for
is CFWriteStreamWrite function write to socket finished and successed?
i have try to read all the .h file of CoreFounadation and CoreService
=> CFNetwork but , no function seems to do such thing! so must i listen
to [kCFStreamEventEndEncountered] event.

i think, perhaps i should begin to write this case by socket but not CF!
 >> Stay informed about: A problem with FTP programing with CFWriteStream. 
Back to top
Login to vote
Michael Ash1

External


Since: Jun 01, 2004
Posts: 820



(Msg. 4) Posted: Fri Apr 28, 2006 9:47 pm
Post subject: Re: A problem with FTP programing with CFWriteStream. [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Mopelee <kingdry_cn.TakeThisOut@sina.com.cn> wrote:
> Hi, everyone:
>
> I use CFReadStreamCreateWithFTPURL function to create a
> CFWriteStream,so that i can upload file to ftp server.
> But,the is a problem,when i call CFWriteStreamWrite function to
> update bytes to ftp server.because it will not block, so when i call
> call CFWriteStreamClose to close the Stream after call
> CFWriteStreamWrite. I found that some bytes haven't tranfer to ftp
> server yet,so i got a error on ftp server with the file, it is smaller
> than the file upload by me.
>
>
> Could anybody know how to deal with this problem? by the way i'm not
> using callback method wich recomand by apple, because it doesn't fit
> with my class.

So, make it fit. You're using a nonblocking asynchronous API, you'd better
get used to the idea and figure out how to work with it. If you *really*
need it to be exposed as a blocking write, you should probably wrap it in
your own functions, probably by using a separate thread to actually run
the runloop that contains the write stream.

--
Michael Ash
Rogue Amoeba Software
 >> Stay informed about: A problem with FTP programing with CFWriteStream. 
Back to top
Login to vote
Michael Ash1

External


Since: Jun 01, 2004
Posts: 820



(Msg. 5) Posted: Fri Apr 28, 2006 10:43 pm
Post subject: Re: A problem with FTP programing with CFWriteStream. [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Mopelee <kingdry_cn.DeleteThis@sina.com.cn> wrote:
> Michael Ash :
> thank u very much. may i know is there any function can polling for
> is CFWriteStreamWrite function write to socket finished and successed?
> i have try to read all the .h file of CoreFounadation and CoreService
> => CFNetwork but , no function seems to do such thing! so must i listen
> to [kCFStreamEventEndEncountered] event.

You are merely restating your original question, which I already answered.
Perhaps you did not understand the answer, in which case I suggest you go
back and read my post again.

--
Michael Ash
Rogue Amoeba Software
 >> Stay informed about: A problem with FTP programing with CFWriteStream. 
Back to top
Login to vote
Mopelee

External


Since: Mar 30, 2006
Posts: 6



(Msg. 6) Posted: Sun Apr 30, 2006 12:19 am
Post subject: Re: A problem with FTP programing with CFWriteStream. [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Michael Ash:
I write a callback function as friend of my class to resolve the
problem,but i found the problem still exist.
So i download the FTP sample from apple site again. i found the
sample have got the same problem.

when i set the upload speed to 10k, then sample cann't finnished upload
the full file. but set upload speed with no limit, it can upload all
size of the file.perhaps really there is some bug in FTP api provide by
apple.

now, i have to find some other way to deal with my project. it is
really a terrible thing.
 >> Stay informed about: A problem with FTP programing with CFWriteStream. 
Back to top
Login to vote
Display posts from previous:   
   Macintosh computer (Home) -> Programmer Help All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]