Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / April 2006



Tip: Looking for answers? Try searching our database.

A problem with FTP programing with CFWriteStream.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mopelee - 29 Apr 2006 02:22 GMT
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.
Mopelee - 29 Apr 2006 03:16 GMT
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
Michael Ash - 29 Apr 2006 03:47 GMT
> Hi, everyone:
>
[quoted text clipped - 10 lines]
> 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.

Signature

Michael Ash
Rogue Amoeba Software

Mopelee - 29 Apr 2006 04:07 GMT
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!
Michael Ash - 29 Apr 2006 04:43 GMT
> 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.

Signature

Michael Ash
Rogue Amoeba Software

Mopelee - 30 Apr 2006 08:19 GMT
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.