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

Author Message
Guest2468

Guest


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

Code:
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
Guest2468

Guest


the code above is within try catch as well.
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 27059
Location: Prague, Czechia
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.
Advertisements

You can post new topics in this forum

Search

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License