connection gets unexpectedly closed.

Advertisement

akushner
Guest

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 vb.net 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

Try
' Setup session options
With mySessionOptions
'PayPal -- Is below right?
.Protocol = Protocol.Sftp
.HostName = "reports.paypal.com"
.UserName = "sftpun_plafaveevansdist.com"
.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 = "69.20.63.106"
'.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"

'HostName=69.20.63.106
'PortNumber = 2402
'UserName = cust - gsa - ftp
'LocalDirectory=C:%5CUsers%5Cdraste%5CDocuments
'RemoteDirectory=/ftp/test/fromAccenture
'Password = A35C765E63F63F292F28713B2F3D713A282C6A65726E6C726A6F726D6C6A3230292E393A2B10781634097A196F76386FCFA9
End With

mySession = New Session
' Connect
mySession.Open(mySessionOptions)

' 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")
'Next

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
Else
transferResultGet.Check()
Return 1
'dt = dt.AddDays(-1)
End If
'Loop

' Throw on any error

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

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

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
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

Advertisement

You can post new topics in this forum