Location: California USA
Posted: 2013-12-27 22:10
Firstly... thank you up front for any help you may be able to provide!
WinSCP.exe verion = 22.214.171.12439
Language = VB6/Com
I am not able to sucessfully connect and upload a file to a remote SFTP server using VB/Com.
Remote connection requirement has specific port number (10022), but trying to apply the port into the VB/com parameters has not sucessfully worked thus far.
Ability to compose vb/com parms to sucessfully connect to sftp server with a specific port
When I manually connect via WinSCP.exe I can connect to the remote server - no issues
File Protocol = SFTP
Host name = <ipaddress>
Port number = 10022
User name = <username>
Password = <password>
sshHostKey = <hostkey saved in ini>
1. Adding ":port" to host name - Get response - Error: Host "ipaddress:10022" does not exist. This response is practially immediate.
2. Do not add ":port" to hostname - Get response - Error: Network Error: Connection to "ipaddress" timed out. This takes several seconds to return back with the response.
3. Adding any prefix to the ipaddress ie "ftp://ipaddress" also fails (probably as expected) with error that host does not exist
Private Sub Command4_Click()
Dim mySession As New Session
' Enable custom error handling
On Error Resume Next
' Query for errors
If Err.Number <> 0 Then
MsgBox "Error: " & Err.Description
' Clear the error
' Disconnect, clean up
Private Sub SCPUpload(ByRef mySession As Session)
' Setup session options
Dim mySessionOptions As New SessionOptions
Dim wUrl As String
wUrl = Me.txtUrl.Text
If Me.txtPort.Text <> "" Then
wUrl = wUrl & ":" & Me.txtPort.Text
.Protocol = Protocol_Sftp
.HostName = wUrl
.UserName = Me.txtUsername.Text
.Password = Me.txtPassword.Text
.SshHostKeyFingerprint = Me.txtHostKey.Text
' Upload files
Dim myTransferOptions As New TransferOptions
myTransferOptions.TransferMode = TransferMode_Binary
Dim transferResult As TransferOperationResult
Set transferResult = mySession.PutFiles(Me.txtSource.Text, "", False, myTransferOptions)
' Throw on any error
' Display results
Dim transfer As TransferEventArgs
For Each transfer In transferResult.Transfers
MsgBox "Upload of " & transfer.FileName & " succeeded"
Location: Prague, Czechia
You can post new topics in this forum
And it's free!