Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
2.9k views
in .NET FTP by (160 points)
I'm sure this is a stupid mistake, but I'm stuck here.

First I use client.size() to get the file size.
Then I use client.get() to download the file

The get command ends at 52.46 or 52.47% of the reported file size.
This percentage is consistent between different sized files!

Here is the code:

Private WithEvents client As FTPClient

Private size As Long

Sub Main()

client = New FTPClient
client.RemoteHost = "none.ofyourbusiness.com"
client.ControlPort = 21

client.Connect()
client.Login("user", "password")

size = client.Size("/usr/home/photo_album.tar.bz2")
client.Get("c:\WEBSITE_BACKUPS\photo_album.tar.bz2", "/usr/home/photo_album.tar.bz2")

Console.WriteLine("Transfer complete")
Console.ReadLine()

End Sub

Private Sub client_BytesTransferred(ByVal sender As Object, ByVal e As EnterpriseDT.Net.Ftp.BytesTransferredEventArgs) _
Handles client.BytesTransferred

Console.Clear()

Console.WriteLine(((e.ByteCount / size) * 100).ToString("N2") & vbCrLf & _
e.ByteCount.ToString("N0") & " / " & size.ToString("N0") & vbCrLf)

End Sub


Output:

>52.46
>2,275,054 / 4,337,124
>
>Transfer Complete


Any ideas as to what I'm doing wrong here???

2 Answers

0 votes
by (162k points)
Can you post the log file? Then we'll see actually what the FTP server claims the size is etc.
0 votes
by (160 points)
Set the transfer type to "binary" before getting the file. The client defaults to ASCII mode.

Somtimes it hurts to be stupid...

Categories

...