Home Forums ActiveX components Xceed FTP for ActiveX Issue transferring a file via SFTP

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #42756 |

    I’m attempting to transfer a file via SFTP, but I consistantly reach an error: “The command socket was disconnected from the FTP server.” at my EndConnect line. Below is some of my source. Has anyone happened upon a solution for this?

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Xceed.Ftp.Licenser.LicenseKey = System.Configuration.ConfigurationManager.AppSettings(“componentLicense”)
    Dim iphost As IPHostEntry = Dns.Resolve(“ServerName”)
    Dim sftpServerAddress = iphost.HostName.ToString
    Dim sftpServerPort = “22”
    Dim sftpUsername = “Domain/User”
    Dim sftpPassword = “Password”

    ‘ Create an instance of an FTP Client
    Dim FtpClient1 As Xceed.Ftp.AsyncFtpClient = New Xceed.Ftp.AsyncFtpClient()

    AddHandler FtpClient1.CertificateReceived, AddressOf Certificate_received

    ‘ Connect and Login to the FTP Client
    Dim result As IAsyncResult = FtpClient1.BeginConnect(sftpServerAddress, sftpServerPort, AuthenticationMethod.Tls, VerificationFlags.None, Nothing, Nothing, Nothing)

    FtpClient1.EndConnect(result)

    FtpClient1.Login(sftpUsername, sftpPassword)

    FtpClient1.SendFile(“C:\test\test1.txt”)

    FtpClient1.Disconnect()

    RemoveHandler FtpClient1.CertificateReceived, AddressOf certificate_received
    End Sub

    Public Sub certificate_received(ByVal sender As Object, ByVal e As CertificateReceivedEventArgs)
    e.Action = VerificationAction.Accept
    End Sub

    Imported from legacy forums. Posted by Jaye (had 6080 views)

    User (Old forums)
    Member
    Post count: 23064

    Normally the port must be set to 990 when making a secure connection

    Imported from legacy forums. Posted by André (had 489 views)

    User (Old forums)
    Member
    Post count: 23064

    Caught that a few hours ago, but thank you kindly. 🙂

    For anyone else that runs accross this issue, 990 is the standard implicit ssl port on most sftp servers and 22 the standard sftp port.

    <i><color=”red”>* Could be different depending on your configuration.</color></i>

    When using Xceed FTP for sftp via SSL/TLS (SSH is not supported), use that implicit ssl port for your port number in your BeginConnect.

    Imported from legacy forums. Posted by Jaye (had 7943 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.