Login  
Search All Forums
Dart Home | PowerTCP FTP for ActiveX | Custom Development Reply | PowerTCP FTP for ActiveX Topics | Forums   
AuthorForum: PowerTCP FTP for ActiveX
Topic: Incomplete listing
dummyboy

From: Terrebonne, QC Canada
Posts: 12
Member Since: 06/27/05
posted October 14, 2005 11:46 AM

We developed a service which connect to a FTP server at fixed interval to automatically download the contents of a remote directory. But we noticed that sometimes, the service did not download all the files from the directory. We reviewed all our code and nothing seems wrong (basically, it is a call to .List and then loop into each entry to call a .Retrieve).

So, we developed a test application which just call .List at a 5 second interval and check if .List.Count returns the good value. Surprise! After 40 minutes (~500 tries), the app displayed a message that the count was not good, and dumped the .List.Text in a box... and we saw that the listing was incomplete!

(Note that no error was raised, no Error event was called, etc, etc)

Then, the app continued and the following calls were good, until many, many other calls, where the problem occured again.

Of course, the FTP server was suspected, but the same server is accessed by other apps, which not use DartFTP (coded using API calls). These apps are running since 2 years, and they never had this problem.

So, what do you think about that?

Actually, we plan to code two consecutive calls to .List and compare the count of each call, to make sure that the listing is not incomplete.
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted October 14, 2005 1:09 PM

Can you duplicate this behavior with our sample FtpListView app? If so, please tell me what I need to do to duplicate it. If possible, use a public server that I have access to so that we are using the same scenario.
dummyboy

From: Terrebonne, QC Canada
Posts: 12
Member Since: 06/27/05
posted October 14, 2005 1:57 PM

Please take note that this problem occurs on big listing, ie, a directory containing hundreds of file. We tried to get the error on a small listing but it never happened.

We can try to reproduce using FtpListView, but we will need to modify it to have a timer which will trigger the .List call at fixed interval.
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted October 14, 2005 2:25 PM

If that fails, modify your other FTP apps to refresh every 5 seconds and see what happens.

dummyboy

From: Terrebonne, QC Canada
Posts: 12
Member Since: 06/27/05
posted October 14, 2005 4:59 PM

For your infos... Here's the code in our test application. As you can see, it is very simple:

At a 5 second interval...
a) Connect if not connected yet
b) Set directory
c) Get list
d) Compare list count and display error if needed

Monday, we'll try using FtpListView and our API app.


Private Sub Timer1_Timer()

  On Error GoTo ErrHandler

  'Connect if needed  
  If f.State <> tcpConnected Then
  
    f.Login txtServer.Text, _
        txtUser.Text, _
        txtPassword.Text, _
        , _
        txtPort.Text
  
  End If

  'Get the directory listing 
  f.Directory = txtRemotePath.Text
  f.List
  
  'Compare lisiting count  
  If (f.Listing.Count <> txtQtyToCheck.Text) Then

    'Display received text and raise error  
    txtText.Text = f.Listing.Text
    Err.Raise vbObjectError, , "Bad quantity! (Received: " & f.Listing.Count & ")"
  
  End If
  
  'Skip error handler
  Exit Sub
  
  
ErrHandler:

  'Add error description to log list box
  LogText UCase$(Err.Description)

End Sub
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted October 17, 2005 9:42 AM

What happens if you disable the timer when you enter the Tick event, then re-enable it after the List?

dummyboy

From: Terrebonne, QC Canada
Posts: 12
Member Since: 06/27/05
posted October 17, 2005 10:17 AM

We could try, but it should change nothing. The real app disable the timer object and then re-enable it before exiting the procedure.

About the FtpListView test, here's what I did in the code:

1) I dropped a disabled Timer object on the main form, set it to a 5 seconds interval. The event handler simply calls "DoRefresh"

2) I added a line at the end of DoLogin which enable the timer

3) I added a line at the end of DoLogout which disable the timer

4) I dropped two new TextBox on the main form, one for the count to compare, and the other to contain the listing text in case of error. I added this code in "DoRefresh", between the ".List" call and "DisplayListing" call:

If Ftp1.Listing.Count <> CLng(txtQtyToCheck.Text) Then
  txtReceivedListing.Text = Ftp1.Listing.Text
  Timer1.Enabled = False
  MsgBox "Error in listing!"
End If

So, once logged in, the app should execute DoRefresh every 5 seconds and should pop a message if the count mismatches the value in the textbox named "txtQtyToCheck".

We can test only soon in the morning, so we should have a result tomorrow. I'm working to build an app using API calls now, and we should test it tomorrow morning too.
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted October 17, 2005 10:19 AM

Ok, thanks. I am unable to duplicate this here so I will await your results.
Reply | PowerTCP FTP for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX