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.