Exception thrown after IwodFtpDLXComPtr::Abort - WeOnlyDo Discussion board

Exception thrown after IwodFtpDLXComPtr::Abort (wodSFTP / wodSFTP.NET / wodSFTPdll)

by jz1, Wednesday, June 28, 2006, 17:45 (6533 days ago)

Hi there --

I'm a newbie to the wodFtpDLX libraries. I modified the sample ATL ConsoleApp to abort a transfer and it threw an exception. I added some code to the event sink callback DispProgress to call m_pWodFtpCom->Abort after a few megabytes had been transferred. An exception is then thrown from the pFtpCom->PutFile in the main code. I catch the exception and then continue with the disconnect and release. Is the exception normal? Is this a safe way for me to abort a transfer or should I use some other method?

Compiler: Microsoft Visual Studio .Net 2003 C++
DLL version: 2.6.0.252

Thanks!
Joe

Re: Exception thrown after IwodFtpDLXComPtr::Abort

by wodDrazen, Wednesday, June 28, 2006, 18:08 (6533 days ago) @ jz1

Hi Joe,


Abort Method aborts method that is currently executing.
You should just call this method when you want to end transfer.
After some short time (cannot happen immediately) your transfer will stop with an error 40551 (Transfer aborted) and you will be able to resume your operations later.
Connection with the server will not be broken.

Aborting file transfer may not stop immediately - you should wait until Done event is fired in order to execute next command.

Hope this helps.


Regards,
Drazen

Re: Exception thrown after IwodFtpDLXComPtr::Abort

by jz1, Wednesday, June 28, 2006, 18:45 (6533 days ago) @ wodDrazen

Thanks for the quick reply. I'm wondering how to abort an operation since the PutFile call is blocking and the only place I can call the Abort method is from the event sink. When I call Abort, the PutFile throws an exception. It looks like the abort works ok. I'm perfectly happy catching the exception if this is the way it is supposed to work. But as you say and as the documentation says, the PutFile is supposed to return an error code. The documentation doesn't metion an exception. I just want to know if it is safe for me to perform the abort like this. Thanks again.

Joe

Re: Exception thrown after IwodFtpDLXComPtr::Abort

by wodDrazen, Wednesday, June 28, 2006, 18:58 (6533 days ago) @ jz1

Hi Joe,


Yes it is perfectly safe to us Abort Method for aborting PutFile Method.

You will receive error after aborts in Done Event ErrorCode for that error is 40551 and ErrorText is Action aborted: broken pipe .

Connection will not be lost if you call Abort Method as I mention in my last post.

Hope I helped.


Regerds,
Drazen

Re: Exception thrown after IwodFtpDLXComPtr::Abort

by jz1, Wednesday, June 28, 2006, 21:09 (6532 days ago) @ wodDrazen

I figured out where the exception was coming from. It was a rookie mistake on my part. I had to add the raw_interfaces_only directive to the #import statement in the ConsoleApp.cpp file. This causes the compiler not to generate the wrapper code that throws the exceptions when a COM error is returned from the COM object.

Joe