Event handling problems in spite of Blocking - WeOnlyDo Discussion board

Event handling problems in spite of Blocking (wodSFTP / wodSFTP.NET / wodSFTPdll)

by condev1972, Sunday, May 14, 2006, 17:34 (6582 days ago)

Good day,

I'm having a little trouble of finding out timing
problems with the events of the COM FtpDlx component
(v2.5.7.220; Blocking = True; Delphi 5 Ent. SP1 on
Win XP Pro SP2, connecting with FTP protocol to a
FileZilla server on a machine in a local network).

Process:
* user presses a button which does call the Connect1
method (renamed by Delphi for other reasons),
with property Blocking is set True .
* in the upcoming OnConnected event I then set the
RemotePath property and call ListDir .
* afterwards in the OnListItems event I fill a
listview component with the listing entries etc.

Problem:
Strangely the ListDir method is not always executed
from within the OnConnected event, at least not at
the very first time upon application startup.
Upon disconnect and reconnect (i.e. the 2nd time),
however, the directory listing does show up.

The same applies to GetFile method: directly after
the call I'm trying to load the downloaded file into
an editor component, which also does not work always.

Question:
I fear that I always have to use the OnDone event
to continue processing with whatever I need to do
with the FTP component, although Blocking is True ?

Meaning: I cannot use a downloaded file right after
the GetFile method, but have to wait for the Done
event. This would practically require shifting most of
the FTP processing code into the Done event itself and
manually keeping track of what the last command actually
was.
If, though, my above order of commands would be ok,
then the Blocking does not seem to work always in
my case.

Please be so kind to provide me some best practice
advice or hints of what I might have done wrong/what
is wrong with above assumptions.

Thank you very much in advance for your assistance.

Kind regards,
Tobias
[:smile:]

Re: Event handling problems in spite of Blocking

by wodDrazen, Sunday, May 14, 2006, 20:18 (6582 days ago) @ condev1972

Hi Tobias,


I did as you mention in your process chapter (only difference is that I fill Memo with listing entries) in Delphi5.
After that connect to FileZilla Server and execute ListDir Method under Connected Event while Blocking = True.
Application that I run listed RemotePath every time and there is no problem at all.

Maybe you are using oldest version of wodFtpDLX ActiveX component and this could be a bug that if fixed in meantime.
Latest version wodFtpDLX ActiveX component is 2.5.7.
You can check latest version by calling Version Property.

If you are licensed user you can request latest version on this page:
http://www.weonlydo.com/index.asp?update=1
This is automated process. Make sure you use same email address that is registered with our system, one you used when you have purchased the product.

Or for evaluating you can download latest version here:
http://www.weonlydo.com/Samples/wodFtpDLX.exe

Hope this helpd.


Regards,
Drazen

Re: Event handling problems in spite of Blocking

by condev1972, Sunday, May 14, 2006, 21:13 (6582 days ago) @ wodDrazen

Hello Drazen,
glad to hear from you again.

As noted in my initial message, I am indeed using the current
version 2.5.7.220.


I did as you mention in your process chapter (only difference is that I fill Memo with listing entries) in Delphi5.
After that connect to FileZilla Server and execute ListDir Method under Connected Event while Blocking = True.
Application that I run listed RemotePath every time and there is no problem at all.

I did add Application.ProcessMessages; within my code
after ListDir which seems to have fixed the issue with
the Connect, RemotePath, ListDir commands (in that order).

Shall I understand your answer in that way, that I do
*not* have to wait for the OnDone event before calling
the next method?

I have still problems with the GetFile method which still
most of the time does not transfer the file or does not
allow to load the downloaded file afterwards. As a specialty,
the downloaded files are only 4 bytes of size, maybe that
matters.

Thanks and looking forward to hearing from you again.

Regards,
Tobias

Re: Event handling problems in spite of Blocking

by wodDrazen, Sunday, May 14, 2006, 22:46 (6582 days ago) @ condev1972

Hi Tobias,


I think that we duplicate your error with GetFile Method.
We will answer you soon as we find some solution.

For executing next method while Blocking = True.
You shouldn't execute methods from within event code move your code from 'Connected' event to just after calling 'Connect' method.

Hope I helped.


Regards,
Drazen

Re: Event handling problems in spite of Blocking

by condev1972, Sunday, May 14, 2006, 22:53 (6582 days ago) @ wodDrazen

Thanks for your efforts, Drazen, hope to hear from
you soon again re: probable fixes.

For executing next method while Blocking = True.
You shouldn't execute methods from within event code move your code from 'Connected' event to just after calling 'Connect' method.

Calling the ListDir after Connect (in e.g. the
button-click event handler) was my first approach, which
didn't work that well. I'll try again anyway, i.e. move
the code out of the Connected-event again.

Thanks,
Tobias

Re: Event handling problems in spite of Blocking

by wodDrazen, Sunday, May 14, 2006, 23:22 (6582 days ago) @ condev1972

Tobias,


Would you be so kind to download latest version of wodFtpDLX ActiveX component.
Latest version is 2.5.7.221 and I think you have 2.5.7.220.
Maybe this will solve your problem.
I tested with GetFile Method as you mention and I didn't get error any more.

Let us know how it goes.


Drazen

Re: Event handling problems in spite of Blocking

by condev1972, Monday, May 15, 2006, 15:38 (6581 days ago) @ wodDrazen

Hello WOD'ers,

thanks for all your valuable time & input.
Seems like I got the event problems under control now
with some code restructuring.

Cheers,
Tobias