Downloading to a read-only file and progress in SS (wodSFTP / wodSFTP.NET / wodSFTPdll)

by gn, (7143 days ago)

Hi,

I've started evaluating your FTP component (wodFtpDLXCom), and it seems better that other ones I tried. A couple of question so far:

1. When I use GetFile(), and the local target file is read-only, the function returns immediately, but there's no error in the Done event.
2. When I use SFTP (over OpenSSH), the last Progress event comes with Position=0.

Thanks,

-gn

locked

Re: Downloading to a read-only file and progress i

by Jasmine, (7143 days ago) @ gn

GN,

hi.

1. When I use GetFile(), and the local target file is read-only, the function returns immediately, but there's no error in the Done event.

Did you check for errors returned by GetFile? Perhaps it returned some sort of 'permission denied' error already?

2. When I use SFTP (over OpenSSH), the last Progress event comes with Position=0.

Hmm, we didn't have such reports so far. You are downloading file, right? I have to see if I can duplicate that.

Regards,
Kreso

locked

Re: Downloading to a read-only file and progress i

by gn, (7143 days ago) @ Jasmine

Kreso,

Did you check for errors returned by GetFile? Perhaps it returned some sort of 'permission denied' error already?

According to the Help (and my degugging), GetFile does not return a value.

Hmm, we didn't have such reports so far. You are downloading file, right?

Yes.

-gn

locked

Re: Downloading to a read-only file and progress i

by Jasmine, (7142 days ago) @ gn

GN,

According to the Help (and my degugging), GetFile does not return a value.

No, GetFile doesn't return anything directly. It sets up 'Error' object which is handled differently by programming environment. In VB it's, for example, 'Error' object (On Error Resume Next...)

wodFtpDLX should throw 30024 if it cannot open local file, can you double check that? Perhaps it was thrown?

locked

Re: Downloading to a read-only file and progress i

by gn, (7142 days ago) @ Jasmine

How do you handle 'Error' object in MSVC++?

locked

Re: Downloading to a read-only file and progress i

by Jasmine, (7142 days ago) @ gn

That's not easy to answer. Depends on project type. Try to step in into GetFile, to see wrapper made by MFC. You will see that eventually it calls GetFile and takes back long value (HRESULT actually). If result != 0 then it usually throws an exception.

ATL handles is differently, etc..

You could zip your project and send it overhere, I will take a look and try to make error handler for you.

locked

Re: Downloading to a read-only file and progress i

by gn, (7142 days ago) @ Jasmine

I'm using your WithEvents MFC sample. And eventually GetFile calls COleDispatchDriver::InvokeHelperV, which has the following:

[code]SCODE sc = m_lpDispatch->Invoke(dwDispID, IID_NULL, 0, wFlags, &dispparams, pvarResult, &excepInfo, &nArgErr);[/code]

The sc is 0 (successfull), and excepInfo has nothing.

locked

Re: Downloading to a read-only file and progress i

by Jasmine, (7142 days ago) @ gn

Gn,

this was a bug - we detected the error but didn't returned it. Now it's fixed. Please download wodFtpDLX again, or request update if you're licensed user.

BTW, now when you test, in OLEDISP1.cpp line 1017 you will see error is trapped in CATCH_ALL(e). It will probably be re-thrown to your code.

locked

Re: Downloading to a read-only file and progress i

by gn, (7142 days ago) @ Jasmine

The latest build does throw the following exception Error occurred trying to write to local file. This is fine, I can use exceptions blocks around the calls to wodFtpDLX. Still, why the Done event is not automatically generated with the error? Isn't it what the Helps says:

[code]For each method issued by the user (MakeDir, ListDir, DeleteFile...) this event will be fired to signalize that method has completed, and that it was (successfully) executed. If error occurred, ErrorCode will contain non-zero error code that determines the error. In such case, ErrorText will contain string representation of the error - if it was provided by the server, your OS or the wodFtpDLX itself.[/code]

Thanks,

-gn

locked

Re: Downloading to a read-only file and progress i

by Jasmine, (7142 days ago) @ gn

Gn,

component never gets that far to start anything - it returns much before, that's why Done isn't fired.

locked

Re: Downloading to a read-only file and progress i

by gn, (7142 days ago) @ Jasmine

OK, I think I'll just surround all calls with try-catch.

Now, to my second question:

2. When I use SFTP (over OpenSSH), the last Progress event comes with Position=0.

Thanks,

-gn

locked

Re: Downloading to a read-only file and progress i

by Jasmine, (7142 days ago) @ gn

True, found it and fixed it.

locked

Re: Downloading to a read-only file and progress i

by gn, (7141 days ago) @ Jasmine

Cool. Is the fix avalable?

locked

Re: Downloading to a read-only file and progress i

by Jasmine, (7141 days ago) @ gn

Yes, if you use demo, then download it again. If you're licensed user, go to http://www.weonlydo.com/index.asp?update=1 and request update.

locked

Re: Downloading to a read-only file and progress i

by gn, (7141 days ago) @ Jasmine

Thanks, the fix works.

-gn

locked