Abort a specific async transfer

0 votes
asked Jul 20, 2010 by Paul (140 points)
edited Mar 22, 2011

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
answered Jul 21, 2010 by Lukas Pokorny (92,890 points)
edited Jul 21, 2010

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);
...