0 votes
by (140 points)
edited

AbortTransfer has an object parameter to help identify which operation to abort but I could not find any examples on how to use it. If I launch two BeginGetFile(s), how do I abort a specific one using AbortTransfer?

Regards,

Paul

Applies to: Rebex SFTP

1 Answer

0 votes
by (132k points)
edited

You have to pass some object as state argument to BeginGetFile(s) - then you can use the same object in the AbortTransfer call:

int state = 1; // any type can be used as 'state'
IAsyncResult ar = sftp.BeginGetFile("file.txt", "file.txt", 0, 0, -1, callback, state);
...

sftp.AbortTransfer(state);
...