I have a working application that used the SecureFTPConnection class to connect to a server, get a directory listing, download and then delete on the server the desired files and disconnect.
The server has been changed to use FTPS.
So I changed the SecureFTPConnection class to SSLFTPClient class and changed the property names for the classes. However I have gotten connection errors on this line:
ftpConnection.Auth(SSLFTPSSLVersion.DETECT)
When I leave the line in my code with any of the 3 settings I get this error
Timeout waiting for handshake completion
If I comment out the line I get htis error
Non SSL connections forbidden (code=530)
I have also looked at the online example for this
http://www.enterprisedt.com/products/ed ... lient.html but that is not helping me either and is a little more confusing because I get an "is not a member..." errors on the line :
// Turn off server validation (ONLY do this when testing)
ftp.setValidateServer(false);
I am able to connect to the server but that is as far as I get. I seem to be missing a basic understanding of what I am trying to set up.
any help is appreciated.
Here is the code I am working with minus some lines stripped out that have nothing to do with connecting.
Dim ftpConnection As New SSLFTPClient ' SecureFTPConnection
Dim strFiles As String = ""
Dim workingDir As String = Me.WorkingDir
Dim dirFiles As FTPFile()
Dim dFile As FTPFile
Dim remoteFileName As String = ""
Dim fileSize As Long = 0
Dim myDate As String
Dim sTodaysFile As String
myDate = Date.Now.ToString("yyyyMMdd")
sTodaysFile = "Trans_" & myDate & ".txt"
Try
' just to be safe make sure our storage directory exist
If Not Directory.Exists(workingDir) Then
Directory.CreateDirectory(workingDir)
End If
Try ' Attempt to catch FTP errors so we can handle them differently then a regular exception
' Set up FTP object
ftpConnection.LicenseKey = Me.LicenseKey
ftpConnection.LicenseOwner = Me.LicenseOwner
' setting server address and credentials
ftpConnection.RemoteHost = Me.HostAddress 'ftpConnection.ServerAddress = Me.HostAddress
ftpConnection.ControlPort = Me.HostPort 'ftpConnection.ServerPort = Me.HostPort
'ftpConnection.User(Me.UserName) 'ftpConnection.UserName = Me.UserName
'ftpConnection.Password(Me.Password) 'ftpConnection.Password = Me.Password
'ftpConnection.Protocol = FileTransferProtocol.SFTP
ftpConnection.ServerValidation = SecureFTPServerValidationType.None
ftpConnection.Timeout = Me.Timeout
' connect to server
Me.RaiseNewStatusChange("Connecting to " & Me.HostAddress, 0, 0)
ftpConnection.Connect()
Catch exx As FTPException
Me.RaiseNewStatusChange("FTP EXCEPTION - IMS.GiftCard.Downloader:Thrown during GiftCard FTP Import of File " & remoteFileName & System.Environment.NewLine & exx.Message.ToString, 0, 0)
UBC.Services.Valutec.ImporterRoutines.Send("FTP EXCEPTION - IMS.GiftCard.Downloader:", "Thrown during GiftCard FTP Import of File " & remoteFileName & System.Environment.NewLine & exx.Message.ToString)
Exit Sub
Catch ex As Exception
' Problem with FTP connection
Me.RaiseNewStatusChange("FTP EXCEPTION - The connection was not established with the FTP due to FTP problems", 0, 0)
UBC.Services.Valutec.ImporterRoutines.Send("FTP EXCEPTION - IMS.GiftCard.Downloader:", "The connection was not established with the FTP due to FTP problems")
Exit Sub
End Try
If ftpConnection.IsConnected Then
ftpConnection.Auth(SSLFTPSSLVersion.DETECT)
ftpConnection.User(Me.UserName) 'ftpConnection.UserName = Me.UserName
ftpConnection.Password(Me.Password) 'ftpConnection.Password = Me.Password
Me.RaiseNewStatusChange("Connected", 5, 100)
' Get a listing of files on FTP Server
dirFiles = ftpConnection.DirDetails() 'dirFiles = ftpConnection.GetFileInfos()
I realized I left this line of code in the samples
ftpConnection.Auth(SSLFTPSSLVersion.DETECT)
I was trying that because when I use
ftpConnection.Auth(SSLFTPClient.AUTH_SSL)
I get the error AUTH_SLL is not a member of sslftpclient