Put File not working - WeOnlyDo Discussion board

Put File not working (wodSFTP / wodSFTP.NET / wodSFTPdll)

by Dave M, Wednesday, September 13, 2023, 17:13 (435 days ago)

Hello

I am connecting to a server using SSH2 and with Private Keys. I connect to the server, but when I try to use PutFile - I am getting no where. It stops endlessly on the line of code with PutFIle in it.

I am not sure what to do or try at this point. Can you give me a few ideas?

Dave

Put File not working

by Jasmine, Wednesday, September 13, 2023, 18:59 (435 days ago) @ Dave M

Dave,

hi. It's hard to say without more info. Which product exactly are you using? What kind of server are you connecting to? Can you share some code? Does Progress event fire? Do you get any errors (such as timeout)?

Regards,
Jasmine

Put File not working

by Dave, Thursday, September 14, 2023, 21:32 (434 days ago) @ Jasmine

I am using the SFTP product. We are incorporating the SSH Keys
Sub MainRoutine

Set SFTPFISUpload = New wodSFTPCom
SFTPFISUpload.LicenseKey = "****-****-****-****"
Set SFTPKey = New WODSSHKeyLib.Keys


SFTPFISUpload.Disconnect
SFTPFISUpload.Blocking = True
' SFTPFISUpload.TransferMode = Binary

SFTPKey.Load Trim("C:\cfiles\PrivateKey.ppx"), Password
SFTPFISUpload.HostName = IP Address
SFTPFISUpload.Authentication = authPubkey
SFTPFISUpload.Login = User Name
SFTPFISUpload.PrivateKey = SFTPKey.PrivateKey(RSAkey)


SFTPFISUpload.Timeout = 0
SFTPFISUpload.KeepAlives = 60

fintSFTPState = STATE_SENDING

SFTPFISUpload.Connect

End Sub


Private Sub SFTPFISUpload_Connected(ByVal ErrorCode As Integer, ByVal ErrorText As String)
' Coming in with ErrorCode = 0

If ErrorCode <> 0 Then
MsgBox "Connect Error = " & ErrorText, vbOKOnly + vbInformation, "FIS Connection"
lblFileUploaded.Visible = False
Exit Sub
Else
lblFileUploaded.Visible = True
lblFileUploaded.Caption = "Connected to FIS"
lblFileUploaded.Refresh
End If


Call FISPmt3SendFile
lblFileUploaded.Caption = "File Uploaded to Processor"
TimerUpload.Enabled = True

End Sub


Private Sub FISPmt3SendFile()
'This just refreshes a label on the form
lblFileUploaded.Caption = "Sending File"
lblFileUploaded.Refresh
DoEvents ' no consequence here - took it out and got the same issue

'We cannot get passed this - it just halts and nothing moves
SFTPFISUpload.PutFile fstrFTPUploadFileName, fstrDLXRemotePath

End Sub

This does not send us to any routine to check progress or anything. Just halts.

Dave,

hi. It's hard to say without more info. Which product exactly are you using? What kind of server are you connecting to? Can you share some code? Does Progress event fire? Do you get any errors (such as timeout)?

Regards,
Jasmine

Put File not working

by Jasmine, Thursday, September 14, 2023, 21:34 (434 days ago) @ Dave

Hi.

Ok, please don't use both Blocking = True and Events - since calling blocking method from within events will block everything.

You can move PutFile call to after successful Connect. Since blocking is true, that is line below Connect call.

Does that help?

Jasmine

Put File not working

by Dave M, Friday, September 15, 2023, 15:40 (433 days ago) @ Jasmine

I did what you told me and it worked and then it did not work. I cannot get this to upload consistently

We use the same WODSFTP in multiple programs so I am unconvinced it's an issue with your program. I am wondering if the server could be not connecting due to trying too much at once.

Dave

Hi.

Ok, please don't use both Blocking = True and Events - since calling blocking method from within events will block everything.

You can move PutFile call to after successful Connect. Since blocking is true, that is line below Connect call.

Does that help?

Jasmine

Put File not working

by Dave, Monday, September 25, 2023, 17:52 (423 days ago) @ Dave M

I did what you told me and it worked and then it did not work. I cannot get this to upload consistently

We use the same WODSFTP in multiple programs so I am unconvinced it's an issue with your program. I am wondering if the server could be not connecting due to trying too much at once.

Dave

Hi.

Ok, please don't use both Blocking = True and Events - since calling blocking method from within events will block everything.

You can move PutFile call to after successful Connect. Since blocking is true, that is line below Connect call.

Does that help?

Jasmine

So, I got this working, but it requires a delay. I have to put in a pause in the program to wait 20 seconds. It is in and out of working. One file will upload and the next will not.

Should we be using a newer version of wodSFTP.dll (our version - 3.8.7.220) or a different WOD product?

Dave