Computing.Net > Forums > Programming > Ftp vb6

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Ftp vb6

Reply to Message Icon

Name: Anthony Arde
Date: November 30, 2005 at 05:59:07 Pacific
OS: win Xp Pro Sp2
CPU/Ram: 3.2 P4
Comment:

Hi there, im having some serious trouble trying to get my program to download from an ftp site- it makes my app hang during the download and only sometimes it pulls through after the download is complete- any suggestions...Please...the code is right coz i get the file all the time, but it makes my program hang. Thanks Anthony



Sponsored Link
Ads by Google

Response Number 1
Name: StuartS
Date: November 30, 2005 at 12:15:55 Pacific
Reply:

Seeing the code would really help if you want any help in solving the problem.

Just saying it doesn't work is as useful as sunglasses on a rainy day.

What are you using, APIs or the VB Active X control? Are you checking for feed back from the server.

Don't forget that when you send the request to the server, the server has to respond. If the server is busy, there will be a delay in that response. What is you application doing while it is waiting for this response?

Stuart


0

Response Number 2
Name: Anthony Arde
Date: November 30, 2005 at 23:12:37 Pacific
Reply:

Ok here is the code, i dont know what this uses, it`s a dll called FTP_VB6, that is what i`m using. now i can connect get the file size and change dir no problem but when i start the download it hangs untill it`s finished, sometimes it stays frozen but i can still complete the download. Any help would be awsome!! thanks Ant

strFtpAddress = "ftp.blablabla.co.za"
intServerPort = 21
strUserName = "yousgsdgse"
strPassword = "passletter"

Label13.Visible = True
ConnectSuccess =MyFtp.Connect(strFtpAddress, intServerPort, strUserName, strPassword)

If ConnectSuccess = True Then
Label17.Visible = True
Label17.Caption = "Connection Made"
End If

If ConnectSuccess = False Then
Label17.Visible = True
Label17.Caption = "Connection Failed"
Exit Sub
End If


strDirectoryName = "/httpdocs/PowerCar"
SetCurDir = MyFtp.SetCurrentDirectory(strDirectoryName)

Label14.Visible = True

If SetCurDir = True Then
Label18.Visible = True
Label18.Caption = "Success"
End If

If SetCurDir = False Then
Label18.Visible = True
Label18.Caption = "Failure"
Exit Sub
End If

FileAnalize = MyFtp.GetFileSize("Power Car Consultant.mdb", Filesize)

Label15.Visible = True

If FileAnalize = True Then
Label19.Visible = True
Label19.Caption = Filesize & " Bytes"
End If

If FileAnalize = False Then
Label19.Visible = True
Label19.Caption = "Failure"
Exit Sub
End If

DelSAV.DeleteFile App.Path & "\New\Power Car Consultant.mdb"

Label16.Visible = True

Label20.Visible = True
Label20.Caption = "Getting File"

lngFileTransferType= FTP_TRANSFER_TYPE_BINARY
blnOverwrite = True

DownLoad = MyFtp.DownloadFile("Power Car Consultant.mdb", App.Path & "\New\Power Car Consultant.mdb", lngFileTransferType, blnOverwrite, , Return_ErrorDesc)

Label20.Caption = "Download Complete"
MyFtp.Disconnect


0

Response Number 3
Name: StuartS
Date: December 1, 2005 at 01:59:11 Pacific
Reply:

I am not familiar with that DLL so you are very much on your own there.

If you were using the API or the standard VB Active X I might have been able to help you.

However, all the problems appear to be in the last line. You send the file request, then you are stuck in the DLL until it has finises. If there is any delay at the FTP sever then your app appears to be hung until it returns from the FTP.Download call. That is unavoidable when using a DLL in synchronous mode.

Check the DLLs documentation and see if it has a callback function. This should allow you to monitor the progress of the download and see where the delay is occurring in what is know as asynchronously mode.

Stuart


0

Response Number 4
Name: Anthony Arde
Date: December 1, 2005 at 03:42:53 Pacific
Reply:

Thanks for your help, i have another question though, if you dont mind, this code doesnt work and i have no idea why?, Thanks anthony.

With Inet1
.Protocol = icFTP
.RemoteHost = "ftp.pdfheredttttion.co.za"
.UserName = "pdffdkftionco"
.Password = "fdfkyrtyfs6"
.URL="ftp.pdfheredttttion.co.za/httpdocs/PowerCar/"

.Execute .URL, "Get " & "Test.txt" & " " & App.Path & "\New\Test.txt"

Do While .StillExecuting
DoEvents
Loop

End With


0

Response Number 5
Name: StuartS
Date: December 1, 2005 at 08:20:24 Pacific
Reply:

There is something wrong in the last line where you define the URL. You define the URL separately and the doc name is defined in the get statement. The Doc names should include the full path name relative to the current folder on the FTP server.

.URL="ftp.pdfheredttttion.co.za"

Inet1.Execute URL,"GET httpdocs/PowerCar/Test.txt" & App.Path & "\New\Test.txt"

Everything including and after the GET is a single string. You would be better building the string first to make sure you are getting what you intended.


Try downloading this Example from Microsoft. This demonstrates to to use the API for FTP access. It is a lot faster and more efficient.

Stuart


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Ftp vb6

connecting to ftp server w/ vb6 www.computing.net/answers/programming/connecting-to-ftp-server-w-vb6/5380.html

VB6 FTP hangs - Multithread needed? www.computing.net/answers/programming/vb6-ftp-hangs-multithread-needed/13766.html

VB6 FTP Access connection string www.computing.net/answers/programming/vb6-ftp-access-connection-string/13697.html