connection gets unexpectedly closed.



connection gets unexpectedly closed.

Server sent command exit Status 0.

Log file is not getting generated. Protocol.Sftp. Version 5.5.6. Windows 7 professional. Using GUI with code.

Imports System
Imports WinSCP

Public Class frmMain
Public Shared Function Main() As Integer
Dim frm As frmErrors
Dim mySessionOptions As New SessionOptions
Dim myTransferOptions As New TransferOptions
Dim transferResultPut As TransferOperationResult
Dim transferResultGet As TransferOperationResult
Dim clsShares As New Sharables
Dim dt As Date
Dim mySession As Session
'Dim ror As RemovalOperationResult

' Setup session options
With mySessionOptions
'PayPal -- Is below right?
.Protocol = Protocol.Sftp
.HostName = ""
.UserName = ""
.Password = "A35C655C2F3A282C2932032C303D3A3D2A39392A3D322F38352F28723F33312E392C332E282F722C3D252C3D30723F33310F393D6D646B6A690B3D257D"
.SshHostKeyFingerprint = "ssh-rsa 2048 d4:7d:76:97:1c:ba:45:e0:59:b9:e5:49:23:b3:ac:02"
'Girl Scouts -- Is below right?
'.Protocol = Protocol.Sftp
'.HostName = ""
'.UserName = "cust-gsa-ftp"
'.Password = "A35C765E63F63F292F28713B2F3D713A282C6A65726E6C726A6F726D6C6A3230292E393A2B10781634097A196F76386FCFA9"
'.SshHostKeyFingerprint = "ssh-rsa 2048 d4:7d:76:97:1c:ba:45:e0:59:b9:e5:49:23:b3:ac:02"

'PortNumber = 2402
'UserName = cust - gsa - ftp
'Password = A35C765E63F63F292F28713B2F3D713A282C6A65726E6C726A6F726D6C6A3230292E393A2B10781634097A196F76386FCFA9
End With

mySession = New Session
' Connect

' Upload files
myTransferOptions.TransferMode = TransferMode.Binary

'Remove only the girl scout files
'ror = mySession.RemoveFiles("/home/user/")
'Copy girl scout file to remote server
' transferResultPut = mySession.PutFiles("c:\GSUSA_EDI\DOC\Outbound\*", "/ppreports/outgoing/", True, myTransferOptions)
'Retrieve the latest PayPal file
'For Each transfer In transferResultPut.Transfers
' MsgBox("Upload of " & transfer.FileName & " succeeded")

dt = Today
'Do While True
transferResultGet = mySession.GetFiles("/ppreports/outgoing/STL-" & clsShares.FormatDateOutputYYYYMMDD(dt) & "*", "c:\GSUSA_EDI\PayPal\Inbound\*", False, myTransferOptions)

If transferResultGet.IsSuccess Then
' Exit Do
Return 1
'dt = dt.AddDays(-1)
End If

' Throw on any error

' Print results
For Each transfer In transferResultGet.Transfers
MsgBox("Upload of " & transfer.FileName & " succeeded")

Return 0
Catch e As Exception
MsgBox("Error: " & e.Message)
Return 1
End Try
End Function

Private Sub frmMain_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim intResult As Integer

intResult = Main()
End Sub
End Class

Reply with quote


Site Admin
martin avatar
Prague, Czechia

Re: connection gets unexpectedly closed.

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

To generate 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


You can post new topics in this forum