Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

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.
Guest2468

the code above is within try catch as well.
Guest2468

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