Does putfiles method throw exceptions without .check() method?

Advertisement

Guest2468
Guest

Does putfiles method throw exceptions without .check() method?

I have been using WINSCP for some time now, but recently I am running into a exception that say, "The specified network name is no longer available".
to handle the exception manually, I removed .check() method for later and did the following

Console.WriteLine(("Uploading file " & Convert.ToString(Me._filesToDeliver(i)) & " to ") + inFTPRequest.RemoteDirectory)

                        transferResult = sftpSession.PutFiles(Convert.ToString(Me._filesToDeliver(i)), inFTPRequest.RemoteDirectory, False, transferOptions)
                        isSuccess = transferResult.IsSuccess
                        If (isSuccess = False) Then
                            Console.WriteLine("Upload failed: " & transferResult.Failures(0).ToString)
                            'retry twice on network failure
                            retry = 1
                            Do While (isSuccess = False And retry <= 2 And transferResult.Failures(0).ToString.Contains("The specified network name is no longer available"))
                                Console.WriteLine("Retrying against network issue(" & retry & ")")
                                Thread.Sleep(SFTPSleepInterval) 'sleep interval
                                transferResult = sftpSession.PutFiles(Convert.ToString(Me._filesToDeliver(i)), inFTPRequest.RemoteDirectory, False, transferOptions)
                                isSuccess = transferResult.IsSuccess
                                retry += 1
                            Loop
                            transferResult.Check()
                        End If

What is happening is that the putfile method itself throws an exception without .check() and thus skips the whole logic for retry. Is that normal for PutFile() method?



The WinSCP version is as shown below:
5.9.2.6958

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,459
Location:
Prague, Czechia

Re: Does putfiles method throw exceptions without .check() method?

Are you sure the exception is thrown by PutFiles?
This looks like a kind of error that would rather happen in Open.

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Advertisement

You can post new topics in this forum