Archived Forum Post

Index of archived forum posts

Question:

FTP AuthTLS slow?

Sep 24 '13 at 17:20

Hello,

My FTP host has plans to enforce explicit FTP over TLS soon. I'm updating my application to support this (just a simple application that sends our application EXEs to our FTP server for customer auto-update purposes.)

Everything works just fine, except that the upload speed is roughly HALF of what it is when not setting AuthTls = 1. Is this a known/expected issue? Using FileZilla for comparison, the upload speed does not seem to be affected by using TLS. Any ideas?

Code below. Thanks! -Dan

FTP.AuthTls = 1
FTP.Ssl = 0

FTP.HostName = "myhost"
FTP.Username = "myuser"
FTP.Password = "mypass"

'connect and login to the FTP server
Success = FTP.Connect()

If Success <> 1 Then
    MsgBox FTP.LastErrorText
    GoTo EndOfSub
End If

FTP.ClearControlChannel

Success = FTP.DeleteMatching(Left(EXEName, InStrRev(EXEName, ".") - 1) & "*.exe")

If Success = -1 Then
    MsgBox FTP.LastErrorText
    GoTo EndOfSub
End If

Success = FTP.AsyncPutFileStart(Source, EXEName2)

If Success <> 1 Then
    MsgBox FTP.LastErrorText
    GoTo EndOfSub
End If

Size = FileLen(Source)
lblSize = "of " & Format(Size / 1024, "##,###,##0") & " KB"
pnl.Visible = True

Do While FTP.AsyncFinished <> 1
    lblKB = Format(FTP.AsyncBytesSent / 1024, "##,###,##0") & " KB"
    prg.Value = Int(FTP.AsyncBytesSent / Size * 100)
    lblPrg = prg.Value & "%"
    Caption = lblPrg & " of " & Source
    lblKBSec = Format(FTP.UploadRate / 1024, "#,##0") & " KB/Sec"

    If FTP.UploadRate > 0 Then
        lblTimeRemaining = FormatSeconds((Size - FTP.AsyncBytesSent) / FTP.UploadRate) & " remaining"
    Else
        lblTimeRemaining = "? remaining"
    End If

    Refresh
    DoEvents

    FTP.SleepMs 1000
Loop

lblKB = Format(FTP.AsyncBytesSent / 1024, "##,###,##0") & " KB"
prg.Value = Int(FTP.AsyncBytesSent / Size * 100)
lblPrg = prg.Value & "%"
Caption = lblPrg & " of " & Source
lblKBSec = "0 KB/Sec"
lblTimeRemaining = "0 sec remaining"

If FTP.AsyncSuccess <> 1 Then
    MsgBox FTP.AsyncLog
End If

FTP.Disconnect

Accepted Answer

if ($f->ftprcsize) { $ftp->put_SoRcvBuf($f->ftprcsize); }

if ($f->ftpsnsize) { $ftp->put_SoSndBuf($f->ftpsnsize); }

try 262144


Answer

That worked, thanks! I had to translate whatever code that is that you're using to figure out the property was SoSndBuf :) 16k seemed to be a good number for me.