Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP Get very slow

Status
Not open for further replies.

petermeachem

Programmer
Aug 26, 2000
2,270
GB
Using Inet control and vb6.
Sending files up the the server is fine, quick and easy. Getting a directory listing from the server is fine. But copying files down from the server is causing problems.

What I am doing is :-

WaitforInet
KillFile "c:\_tmpfile "
inetFTP.Execute inetFTP.URL, "Get " & cFile & " c:\_tmpfile "
WaitforInet

Where :-

Sub WaitforInet()
Dim vDate As Variant

vDate = DateAdd("s", 100, Now)
vStart = Now
Do While inetFTP.StillExecuting
DoEvents
If Now > vDate Then
AddMessage "Timed out"
Exit Do
End If
Loop
End Sub

And it always times out. The file is very little, and there is no download activity.
This seems to work ok on the upload, why not on the down?

By the way, bit miffed no-one bothered with my last question. Had to fix it myself!
Peter Meachem
peter@accuflight.com
 
See, other people get questions answered. Not me though. Typical. Peter Meachem
peter@accuflight.com
 
Hey,

No need to be sarcastic about it. I asked a question about the limits of the Inet control (max size of the files that can be send with FTP), but did I get an answer? Noooooooo.

Anyway, to give you some help...

I use this code to issue a download command.

blnDownload = True
Inet1.Execute , "GET " & strServerFile & " " & strDownloadFile
Do While Inet1.StillExecuting
DoEvents
Loop

Your part looks fine to me. But do you also check the state of the Inet control? You need to do this or you might miss (error) messages from the server. I've given an example of how to catch error mesages given from the Inet control. For more info on the state changed event see the vb help files.

Private Sub Inet1_StateChanged(ByVal State As Integer)

Select Case State

Case icError
MsgBox Inet1.ResponseCode & ": " & Inet1.ResponseInfo, vbCritical, "Error!"

'Since I can't see the code of how you donwload the files, I've given my code here (also part of statechanged event)

Case icResponseCompleted

If blnDownload = True Then
Open strDownloadFile For Binary Access Write As #1
varData = Inet1.GetChunk(10240, icByteArray)
DoEvents
If Len(varData) <> 0 Then
Do While blnFinished = False
Put #1, , varData
varData = Inet1.GetChunk(10240, icByteArray)
DoEvents
If Len(varData) = 0 Then
blnFinished = True
End If
Loop
End If
blnDownload = False

end select

Hope this helps you a bit...

 
Thanks,

I didn't realise that get involved the getchunk bit in that way. The example code I am using (which is remarkably similar to your own) only uses getchunk for a directory listing. I shall give it a try.

If I find any info on the max size, I shall let you know. Peter Meachem
peter@accuflight.com
 
Doesn't seem to work.

I am doing inetFTP.Execute inetFTP.URL, &quot;Get &quot; & cFile & &quot; c:\_tmpfile &quot;
If I follow this with a wait until stillexecuting is false, it always is. I have put a 100 second timeout on this. It always times out, and then tries to read the next file and I get a 'stillexecuting' error. The code for the get case never runs Case icResponseCompleted.
Have you any idea why? Peter Meachem
peter@accuflight.com
 
Weird. I do know that when you're in debugging mode, the code for the icResponsecompleted never seems to run, but it does. it only happens so fast that you never seem to get there. You can try putting a messagebox and the end of the code. If that doens't help, I've a fully working FTP client example that I've used as the basis for my program, I can email you that.

 
I do have a message when it gets to responsecompleted. It gets copied to the end of a list box.

Could you mail me your example please, that would be helpful Peter Meachem
peter@accuflight.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top