Welcome to the Xceed Community Sign in | Join | Help
Community Search  

Issue transferring a file via SFTP

Sort Posts: Previous Next
  •  08-31-2006, 2:43 PM Post no. 6054

    Issue transferring a file via SFTP

    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
  •  09-01-2006, 3:29 PM Post no. 6055 in reply to 6054

    Re: Issue transferring a file via SFTP

    Normally the port must be set to 990 when making a secure connection
    André
    Software Developer and Tech Support
    Xceed Software Inc.
  •  09-01-2006, 3:42 PM Post no. 6056 in reply to 6055

    Re: Issue transferring a file via SFTP

    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.
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.