Runloop doesnt get fired when scheduled with the stream
Runloop doesnt get fired when scheduled with the stream
- Subject: Runloop doesnt get fired when scheduled with the stream
- From: Sivakumar Kandappan <email@hidden>
- Date: Fri, 17 Jun 2011 01:25:20 -0400
- Thread-topic: Runloop doesnt get fired when scheduled with the stream
Hello All
I`m currently doing a FTP client for my project. I`ve scheduled the
readstream/writeStream with the runloop to read the file from the
harddisk/write the file to the harddisk and send it to the server. After
uploading and downloading the file I unschedule the stream from the runloop.
This works fine for the first time I send the file. The second time when i
try to send the file. Streams are getting created and scheduled with the run
loop. But run loop doesnt fire. I don know. Can anyone please help me out
Below are the codes that I used to schedule and unschedule
For uploading
readStream=CFReadStreamCreateWithFile(kCFAllocatorDefault, fileURL);
writeStream=CFWriteStreamCreateWithFTPURL(kCFAllocatorDefault,(CFURLRef )
ftpURL);
BOOL readStreamOpened=CFReadStreamOpen(readStream);
BOOL clientCallBackSet=CFWriteStreamSetClient(writeStream, kNetworkEvents,
MyUploadCallBack, &callBackContext);
CFWriteStreamScheduleWithRunLoop(writeStream, CFRunLoopGetCurrent(),
kCFRunLoopCommonModes);
CFReadStreamUnscheduleFromRunLoop(syncStructure->readStream,
CFRunLoopGetCurrent(), kCFRunLoopCommonModes);
Downloading:-
readStream=CFReadStreamCreateWithFTPURL(kCFAllocatorDefault,(CFURLRef)ftpURL
);
writeStream=CFWriteStreamCreateWithFile(kCFAllocatorDefault,fileURL);
Boolean writeStreamOpened=CFWriteStreamOpen(writeStream);
BOOL status= CFReadStreamSetClient(readStream,
kNetworkEvents,MyDownloadCallBack,& callBackContext);
CFReadStreamScheduleWithRunLoop(readStream, CFRunLoopGetCurrent(),
kCFRunLoopCommonModes);
CFWriteStreamUnscheduleFromRunLoop(syncStructure->writeStream,
CFRunLoopGetCurrent(), kCFRunLoopCommonModes);
Can anyone please help me. I`m cracking my head for 2 days.
_______________________________________________
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