0

I am using SimpleFTPSample to download and upload from FTP server. I have to cancel download after specific time regardless of completion and start uploading. But If I cancel the download and then start upload delegate method stream:handleEvent: is not getting called. Delegate method is getting called if upload starts after download completion.

I am unable to understand the reason. I am creating separate connection for both task.

Since we need to schedule runloop to work with network stream and runloop is not exiting when we forcefully cancel the download, is this the reason?

Do I need to start both operation in separate thread, so that I can start uploading after specific time?

user1101733
  • 258
  • 2
  • 14
  • Is there any way to stop current NSRunLoop? – user1101733 Feb 02 '15 at 07:57
  • I am forcefully stopping download but my runloop is not exiting from it, as a result delegate method is being called after sometime. I want upload should be started as soon as download gets completed. This is the req. – user1101733 Feb 02 '15 at 09:25

1 Answers1

0

I am able to solve my problem by setting kCFStreamPropertyFTPAttemptPersistentConnection property to kCFBooleanFalse. By default this property is true and hence connection doesn't break if we forcefully close it. Actual credit goes to this guy who had given the answer.

Community
  • 1
  • 1
user1101733
  • 258
  • 2
  • 14