Stopping Asynchronous Transfers (AbortAsync)

Use the AbortAsync function to stop an asynchronous task created previously by UploadAsync, DownloadAsync, or TransferURLAsync. Refer to those methods for more information.

Syntax

Object.AbortAsync(long taskIdx)

Parameters

TaskIdx

This is a task index in the array of tasks created by the various asynchronous methods. The default value of taskIdx is - 1 which specifies all the asynchronous tasks in array.

TaskIdx should be between 0 and AsyncTaskNumber minus one.

Example

Set MySite = CreateObject("CuteFTPPro.TEConnection")

MySite.Option("CleanupAsync") = False

'Initialize all necessary fields for MySite : host name, user, password, etc.

MySite.Connect

MySite.DownloadAsync "*.*", "c:\temp"

MsgBox "Number of tasks created: " & MySite.AsyncTaskNumber

If MySite.AsyncTaskNumber > 10 then

MsgBox "Aborting 11th task"

MySite.AbortAsync ( 10 ) 'abort task # 11 (one less then total, since

starts from 0)

End if

 

You must set MySite.Option("CleanupAsync") = False so that all asynchronous tasks are counted. Otherwise, only the last asynchronous task launched will be referenced when calling the AbortAsync method.