Zip Files - WeOnlyDo Discussion board

Zip Files (wodSFTP / wodSFTP.NET / wodSFTPdll)

by Dave M, Tuesday, September 26, 2023, 17:50 (270 days ago)

Is your product unable to upload zip files with SSH by chance?

Dave

Zip Files

by Jasmine, Tuesday, September 26, 2023, 21:33 (269 days ago) @ Dave M

Hi Dave,

wodSFTP does not go into inspection of files in any way - whatever is provided for upload is uploaded as data. So, ZIP or any other file type should be uploaded normally.

What kind of issues are you having?

Regards,
Jasmine

Zip Files

by Dave, Wednesday, September 27, 2023, 23:00 (268 days ago) @ Jasmine

Hi Dave,

wodSFTP does not go into inspection of files in any way - whatever is provided for upload is uploaded as data. So, ZIP or any other file type should be uploaded normally.

What kind of issues are you having?

Regards,
Jasmine

I cannot upload a file consistently using the wodSFTP. I did all the code changes requested. I got the vendor on the phone and we discussed it. I have looked through your website. It connects and drops before the upload happens is the only thing I can think is happening.

Code:
Set SFTPUpload = New wodSFTPCom
SFTPUpload.LicenseKey = "****-****-****-****"
Set SFTPKey = New WODSSHKeyLib.Keys

SFTPUpload.Disconnect
SFTPUpload.Blocking = True 'Tried setting this to false and it still failed

SFTPKey.Load Trim(PrivateKey.ppk), fstrDLXPass 'Note the file name is a parameter we send in
SFTPUpload.HostName = fstrDLXIPAddress
SFTPUpload.Authentication = authPubkey
SFTPUpload.Login = fstrDLXUserName

SFTPUpload.PrivateKey = SFTPKey.PrivateKey(RSAkey)
SFTPUpload.Timeout = 0
SFTPUpload.KeepAlives = 240 ' change from 60 to 120 to 240 - All Failed
SFTPUpload.Resume = True ' This was added

SFTPUpload.Connect

If SFTPUpload.State <> Connected Then
Call TimeBetweenAttempts(10) 'Give the process 10 seconds to connect
End If

Do While SFTPUpload.State <> Connected
Sleep 1000
lintAttempts = lintAttempts + 1
If SFTPUpload.State = Connected Then Exit Do
If lintAttempts = 25 Then 'This was added so we can reconnect - never hit
SFTPUpload.Disconnect
GoTo RetryUpload
End If
If lintAttempts = 35 Then
MsgBox "Could not Connect to Processor ", vbOKOnly + vbInformation, "Upload File"
SFTPUpload.Disconnect
Exit Sub
End If
Loop

If Err <> 0 Then
MsgBox Err.Description, vbCritical, "Connect"
Err.Clear
Exit Sub
Else
lblFileUploaded.Caption = "Connecting to Processor..."
lblFileUploaded.Refresh
SFTPUpload.PutFile lstrLocalFile, fstrRemoteDir
End If

We get to the PutFile line without an issue and acts like the file is uploaded and it is not.

We can upload using this code. We did that yesterday. Today - 4 times it failed.

I am thinking it is on the server side.

Zip Files

by Dave, Wednesday, September 27, 2023, 23:03 (268 days ago) @ Dave

Hi Dave,

wodSFTP does not go into inspection of files in any way - whatever is provided for upload is uploaded as data. So, ZIP or any other file type should be uploaded normally.

What kind of issues are you having?

Regards,
Jasmine


I cannot upload a file consistently using the wodSFTP. I did all the code changes requested. I got the vendor on the phone and we discussed it. I have looked through your website. It connects and drops before the upload happens is the only thing I can think is happening.

Code:
Set SFTPUpload = New wodSFTPCom
SFTPUpload.LicenseKey = "****-****-****-****"
Set SFTPKey = New WODSSHKeyLib.Keys

SFTPUpload.Disconnect
SFTPUpload.Blocking = True 'Tried setting this to false and it still failed

SFTPKey.Load Trim(PrivateKey.ppk), fstrDLXPass 'Note the file name is a parameter we send in
SFTPUpload.HostName = fstrDLXIPAddress
SFTPUpload.Authentication = authPubkey
SFTPUpload.Login = fstrDLXUserName

SFTPUpload.PrivateKey = SFTPKey.PrivateKey(RSAkey)
SFTPUpload.Timeout = 0
SFTPUpload.KeepAlives = 240 ' change from 60 to 120 to 240 - All Failed
SFTPUpload.Resume = True ' This was added

SFTPUpload.Connect

If SFTPUpload.State <> Connected Then
Call TimeBetweenAttempts(10) 'Give the process 10 seconds to connect
End If

Do While SFTPUpload.State <> Connected
Sleep 1000
lintAttempts = lintAttempts + 1
If SFTPUpload.State = Connected Then Exit Do
If lintAttempts = 25 Then 'This was added so we can reconnect - never hit
SFTPUpload.Disconnect
GoTo RetryUpload
End If
If lintAttempts = 35 Then
MsgBox "Could not Connect to Processor ", vbOKOnly + vbInformation, "Upload File"
SFTPUpload.Disconnect
Exit Sub
End If
Loop

If Err <> 0 Then
MsgBox Err.Description, vbCritical, "Connect"
Err.Clear
Exit Sub
Else
lblFileUploaded.Caption = "Connecting to Processor..."
lblFileUploaded.Refresh
SFTPUpload.PutFile lstrLocalFile, fstrRemoteDir
End If

We get to the PutFile line without an issue and acts like the file is uploaded and it is not.

We can upload using this code. We did that yesterday. Today - 4 times it failed.

I am thinking it is on the server side.

Sorry - I did not note - we are using wodSFTP.dll (our version - 3.8.7.220)

Zip Files

by Jasmine, Thursday, September 28, 2023, 07:09 (268 days ago) @ Dave

Hi.

When you say "i did all the code changes requested", who did request those changes? Your code is more/less ok. You should not use Sleep since you block the thread where wodSFTP lives, tho. However, in your specific changes, since Blocking = True, it does not make a difference since blocking calls (Connect, PutFile) stop your execution until they are complete, and then give control back to you anyway.

Anyway, can you remove all of your code and try simple

sftp1 = new wodSFTPCom
sftp1.Hostname = "something"
sftp1.Login = "something"
sftp1.Password = "something" // change this to key authentication if you use it
sftp1.Blocking = true

sftp1.Connect
sftp1.PutFile ......

Those are only required lines to connect and upload file. Your other app's logic could be moved outside of the function that connects to SFTP server.

If above code fails, can you tell me exact error you're getting?

Regards,
Jasmine

Zip Files

by Dave, Thursday, September 28, 2023, 15:41 (268 days ago) @ Jasmine

Hi.

When you say "i did all the code changes requested", who did request those changes? Your code is more/less ok. You should not use Sleep since you block the thread where wodSFTP lives, tho. However, in your specific changes, since Blocking = True, it does not make a difference since blocking calls (Connect, PutFile) stop your execution until they are complete, and then give control back to you anyway.

Anyway, can you remove all of your code and try simple

sftp1 = new wodSFTPCom
sftp1.Hostname = "something"
sftp1.Login = "something"
sftp1.Password = "something" // change this to key authentication if you use it
sftp1.Blocking = true

sftp1.Connect
sftp1.PutFile ......

Those are only required lines to connect and upload file. Your other app's logic could be moved outside of the function that connects to SFTP server.

If above code fails, can you tell me exact error you're getting?

Regards,
Jasmine

Jasmine

I made all the code adjustments - I already posted on the forum. I was grasping at straws at this point.

I made the changes you suggested and it worked. It's not working consistently. I think at this point it's really the server and not the wodSFTP.dll or my code. I literally made the code the same as you suggested and it worked.

Question: After the PutFile, how do we see if an error came back without declaring the wodSFTPCom with a With Events option?

Dave

Zip Files

by Jasmine, Thursday, September 28, 2023, 22:16 (267 days ago) @ Dave

Hi Dave,

if you want to use events, make sure you do NOT set Blocking = true, since this is different approach (in async way) to wodSFTP's behavior. So either use events with blocking = false, or don't use events with blocking = true.

If you use events, check out arguments passed when event was fired for specific error, especially in the Done event.

Regards,
Jasmine

Zip Files

by Dave, Friday, September 29, 2023, 19:53 (266 days ago) @ Jasmine

Jasmine

I tried that with events. The problem is it freezes at the PutFile and does not move to any next line.

I am going to check within the week. I think the last change worked. Unfortunately, the person I am working with is out of the office. If I have further issues, I'll send a new post.

Dave

Hi Dave,

if you want to use events, make sure you do NOT set Blocking = true, since this is different approach (in async way) to wodSFTP's behavior. So either use events with blocking = false, or don't use events with blocking = true.

If you use events, check out arguments passed when event was fired for specific error, especially in the Done event.

Regards,
Jasmine