Error "Remote side unexpectedly closed network connection"

Please post here if you have problems in using Wing FTP Server.
jhoag
Posts: 15
Joined: Tue Dec 18, 2018 4:21 pm
Location: Newark, NY
Contact:

Error "Remote side unexpectedly closed network connection"

Post by jhoag »

We have recently started to receive the following error when UPLOADING files to our WingFTP server (runs Version 6.2.9) when using the WinSCP FTP client (https://winscp.net) version 5.17.3:
Remote side unexpectedly closed network connection
We use a WinSCP script to automate the upload of files, and the log that it generates shows that about every third attempt to upload files to WingFTP will be successful, but any of the other attempts will consistently return the error above.

The WinSCP client provides the following information about the connection it's making to WingFTP:
File transfer protocol = SFTP-3
Cryptographic protocol = SSH-2
SSH implementation = WingFTPServer
Encryption algorithm = AES-256 SDCTR (AES-NI accelerated)
Compression = No
------------------------------------------------------------
Can change permissions = Yes
Can change owner/group = Yes
Can execute arbitrary command = No
Can create symbolic/hard link = Yes/No
Can lookup user groups = No
Can duplicate remote files = No
Can check available space = No
Can calculate file checksum = No
Native text (ASCII) mode transfers = No
------------------------------------------------------------
Additional information
The server does not support any SFTP extension.
In addition, the following is the log file that WinSCP generates when it connects and encounters the error:
. 2020-04-08 06:37:51.543 WinSCP Version 5.17.3 (Build 10325) (OS 10.0.14393 - Windows Server 2016 Standard)
. 2020-04-08 06:37:51.543 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2020-04-08 06:37:51.543 Log level: Normal
. 2020-04-08 06:37:51.543 Local account: **REDACTED**
. 2020-04-08 06:37:51.543 Working directory: C:\ISMUtilities\Data
. 2020-04-08 06:37:51.543 Process ID: 8316
. 2020-04-08 06:37:51.543 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" /console=5.17.3 /consoleinstance=_4276_372 "/script=C:\ISMUtilities\Data\WinSCPAutomationScript.txt" "/log=C:\ISMUtilities\Data\WinSCP.log"
. 2020-04-08 06:37:51.543 Time zone: Current: GMT-4, Standard: GMT-5 (Eastern Standard Time), DST: GMT-4 (Eastern Daylight Time), DST Start: 3/8/2020, DST End: 11/1/2020
. 2020-04-08 06:37:51.543 Login time: Wednesday, April 8, 2020 6:37:51 AM
. 2020-04-08 06:37:51.543 --------------------------------------------------------------------------
. 2020-04-08 06:37:51.543 Script: Retrospectively logging previous script records:
> 2020-04-08 06:37:51.543 Script: option batch abort
< 2020-04-08 06:37:51.543 Script: batch abort
> 2020-04-08 06:37:51.543 Script: option confirm off
< 2020-04-08 06:37:51.543 Script: confirm off
> 2020-04-08 06:37:51.543 Script: open sftp://**REDACTED**:**REDACTED**/ -hostkey="**REDACTED**" -rawsettings FSProtocol=2 SendBuf=0 SshSimple=0
. 2020-04-08 06:37:51.543 --------------------------------------------------------------------------
. 2020-04-08 06:37:51.543 Session name: **REDACTED** (Ad-Hoc site)
. 2020-04-08 06:37:51.543 Host name: **REDACTED** (Port: 22)
. 2020-04-08 06:37:51.543 User name: **REDACTED** (Password: Yes, Key file: No, Passphrase: No)
. 2020-04-08 06:37:51.543 Tunnel: No
. 2020-04-08 06:37:51.543 Transfer Protocol: SFTP
. 2020-04-08 06:37:51.543 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2020-04-08 06:37:51.543 Disable Nagle: No
. 2020-04-08 06:37:51.543 Proxy: None
. 2020-04-08 06:37:51.543 Send buffer: 0
. 2020-04-08 06:37:51.543 SSH protocol version: 2; Compression: No
. 2020-04-08 06:37:51.543 Bypass authentication: No
. 2020-04-08 06:37:51.543 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: Yes
. 2020-04-08 06:37:51.543 GSSAPI: Forwarding: No; Libs: gssapi32,sspi,custom; Custom:
. 2020-04-08 06:37:51.543 Ciphers: aes,chacha20,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2020-04-08 06:37:51.543 KEX: ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2020-04-08 06:37:51.543 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2020-04-08 06:37:51.543 Simple channel: No
. 2020-04-08 06:37:51.543 Return code variable: Autodetect; Lookup user groups: Auto
. 2020-04-08 06:37:51.543 Shell: default
. 2020-04-08 06:37:51.543 EOL: LF, UTF: Auto
. 2020-04-08 06:37:51.543 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2020-04-08 06:37:51.543 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No; Exit code 1 is error: No
. 2020-04-08 06:37:51.543 SFTP Bugs: Auto,Auto
. 2020-04-08 06:37:51.543 SFTP Server: default
. 2020-04-08 06:37:51.543 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2020-04-08 06:37:51.543 Cache directory changes: Yes, Permanent: Yes
. 2020-04-08 06:37:51.543 Recycle bin: Delete to: No, Overwritten to: No, Bin path:
. 2020-04-08 06:37:51.543 DST mode: Unix
. 2020-04-08 06:37:51.543 --------------------------------------------------------------------------
. 2020-04-08 06:37:51.543 Looking up host "**REDACTED**" for SSH connection
. 2020-04-08 06:37:51.559 Connecting to **REDACTED** port 22
. 2020-04-08 06:37:51.559 We claim version: SSH-2.0-WinSCP_release_5.17.3
. 2020-04-08 06:37:51.559 Remote version: SSH-2.0-WingFTPServer
. 2020-04-08 06:37:51.559 Using SSH protocol version 2
. 2020-04-08 06:37:51.559 No GSSAPI security context available
. 2020-04-08 06:37:51.559 Have a known host key of type ecdsa-sha2-nistp256
. 2020-04-08 06:37:51.559 Doing ECDH key exchange with curve Curve25519 and hash SHA-256
. 2020-04-08 06:37:51.637 Server also has ssh-rsa host key, but we don't know it
. 2020-04-08 06:37:51.637 Host key fingerprint is:
. 2020-04-08 06:37:51.637 **REDACTED**
. 2020-04-08 06:37:51.637 Host key matches cached key
. 2020-04-08 06:37:51.637 Initialised AES-256 SDCTR (AES-NI accelerated) outbound encryption
. 2020-04-08 06:37:51.637 Initialised HMAC-SHA-256 outbound MAC algorithm
. 2020-04-08 06:37:51.637 Initialised AES-256 SDCTR (AES-NI accelerated) inbound encryption
. 2020-04-08 06:37:51.637 Initialised HMAC-SHA-256 inbound MAC algorithm
! 2020-04-08 06:37:51.653 Using username "**REDACTED**".
. 2020-04-08 06:37:51.653 Server offered these authentication methods: publickey,password
. 2020-04-08 06:37:51.653 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2020-04-08 06:37:51.653 Using stored password.
. 2020-04-08 06:37:51.653 Sent password
. 2020-04-08 06:37:51.653 Access granted
. 2020-04-08 06:37:51.653 Opening main session channel
. 2020-04-08 06:37:51.653 Opened main channel
. 2020-04-08 06:37:51.653 Started a shell/command
. 2020-04-08 06:37:51.653 --------------------------------------------------------------------------
. 2020-04-08 06:37:51.653 Using SFTP protocol.
. 2020-04-08 06:37:51.653 Doing startup conversation with host.
> 2020-04-08 06:37:51.653 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2020-04-08 06:37:51.668 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2020-04-08 06:37:51.668 SFTP version 3 negotiated.
. 2020-04-08 06:37:51.668 We believe the server has signed timestamps bug
. 2020-04-08 06:37:51.668 We will use UTF-8 strings until server sends an invalid UTF-8 string as with SFTP version 3 and older UTF-8 strings are not mandatory
. 2020-04-08 06:37:51.668 Getting current directory name.
. 2020-04-08 06:37:51.668 Getting real path for '.'
> 2020-04-08 06:37:51.668 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2020-04-08 06:37:51.668 Type: SSH_FXP_NAME, Size: 23, Number: 16
. 2020-04-08 06:37:51.668 Real path is '/'
. 2020-04-08 06:37:51.668 Startup conversation with host finished.
< 2020-04-08 06:37:51.668 Script: Active session: [1] **REDACTED**
> 2020-04-08 06:37:51.668 Script: option transfer binary
< 2020-04-08 06:37:51.668 Script: transfer binary
> 2020-04-08 06:37:51.684 Script: put -nopreservetime -nopermissions "C:\ISMUtilities\Data\newcontactinfo.csv"
. 2020-04-08 06:37:51.684 Copying 1 files/directories to remote directory "/" - total size: 258,302
. 2020-04-08 06:37:51.684 PrTime: No; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask:
. 2020-04-08 06:37:51.684 TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; EncryptNewFiles: Yes; ExcludeHiddenFiles: No; ExcludeEmptyDirectories: No; InclM: ; ResumeL: 0
. 2020-04-08 06:37:51.684 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2020-04-08 06:37:51.684 Getting real path for '/'
> 2020-04-08 06:37:51.684 Type: SSH_FXP_REALPATH, Size: 10, Number: 6416
< 2020-04-08 06:37:51.684 Type: SSH_FXP_NAME, Size: 23, Number: 6416
. 2020-04-08 06:37:51.684 Real path is '/'
. 2020-04-08 06:37:51.684 File: 'C:\ISMUtilities\Data\newcontactinfo.csv' [2020-04-08T06:00:14.179Z] [258302]
. 2020-04-08 06:37:51.684 Copying "C:\ISMUtilities\Data\newcontactinfo.csv" to remote directory started.
. 2020-04-08 06:37:51.684 Binary transfer mode selected.
. 2020-04-08 06:37:51.684 Checking existence of file.
> 2020-04-08 06:37:51.684 Type: SSH_FXP_LSTAT, Size: 28, Number: 6663
< 2020-04-08 06:37:51.684 Type: SSH_FXP_ATTRS, Size: 37, Number: 6663
. 2020-04-08 06:37:51.684 File exists: newcontactinfo.csv;-;258302;2020-04-08T10:37:48.000Z;3;"" [0];"" [0];rw-rw-rw-;1
. 2020-04-08 06:37:51.684 Checking existence of partially transferred file.
> 2020-04-08 06:37:51.684 Type: SSH_FXP_LSTAT, Size: 37, Number: 6919
< 2020-04-08 06:37:51.684 Type: SSH_FXP_STATUS, Size: 32, Number: 6919
< 2020-04-08 06:37:51.684 Status code: 2
. 2020-04-08 06:37:51.684 Opening remote file.
> 2020-04-08 06:37:51.684 Type: SSH_FXP_OPEN, Size: 53, Number: 7171
< 2020-04-08 06:37:51.684 Type: SSH_FXP_HANDLE, Size: 39, Number: 7171
> 2020-04-08 06:37:51.684 Type: SSH_FXP_WRITE, Size: 32819, Number: 7686
. 2020-04-08 06:37:51.684 7 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2020-04-08 06:37:51.684 Type: SSH_FXP_CLOSE, Size: 39, Number: 9732
< 2020-04-08 06:37:51.684 Type: SSH_FXP_STATUS, Size: 25, Number: 7686
< 2020-04-08 06:37:51.684 Status code: 0
< 2020-04-08 06:37:51.684 Type: SSH_FXP_STATUS, Size: 25, Number: 7942
< 2020-04-08 06:37:51.684 Status code: 0
< 2020-04-08 06:37:51.715 Type: SSH_FXP_STATUS, Size: 25, Number: 8198
< 2020-04-08 06:37:51.715 Status code: 0
< 2020-04-08 06:37:51.715 Type: SSH_FXP_STATUS, Size: 25, Number: 8454
< 2020-04-08 06:37:51.715 Status code: 0
< 2020-04-08 06:37:51.715 Type: SSH_FXP_STATUS, Size: 25, Number: 8710
< 2020-04-08 06:37:51.715 Status code: 0
< 2020-04-08 06:37:51.715 Type: SSH_FXP_STATUS, Size: 25, Number: 8966
< 2020-04-08 06:37:51.715 Status code: 0
< 2020-04-08 06:37:51.715 Type: SSH_FXP_STATUS, Size: 25, Number: 9222
< 2020-04-08 06:37:51.715 Status code: 0
< 2020-04-08 06:37:51.715 Type: SSH_FXP_STATUS, Size: 25, Number: 9478
< 2020-04-08 06:37:51.715 Status code: 0
< 2020-04-08 06:37:51.715 Type: SSH_FXP_STATUS, Size: 17, Number: 9732
< 2020-04-08 06:37:51.715 Status code: 0
> 2020-04-08 06:37:51.715 Type: SSH_FXP_REMOVE, Size: 28, Number: 9997
< 2020-04-08 06:37:51.715 Type: SSH_FXP_STATUS, Size: 43, Number: 9997
< 2020-04-08 06:37:51.715 Status code: 0
> 2020-04-08 06:37:51.715 Type: SSH_FXP_RENAME, Size: 60, Number: 10258
< 2020-04-08 06:37:51.715 Type: SSH_FXP_STATUS, Size: 42, Number: 10258
< 2020-04-08 06:37:51.715 Status code: 0
> 2020-04-08 06:37:51.715 Type: SSH_FXP_SETSTAT, Size: 36, Number: 7433
< 2020-04-08 06:37:51.715 Type: SSH_FXP_STATUS, Size: 48, Number: 7433
< 2020-04-08 06:37:51.715 Status code: 0
. 2020-04-08 06:37:51.715 Transfer done: 'C:\ISMUtilities\Data\newcontactinfo.csv' => '/newcontactinfo.csv' [258302]
. 2020-04-08 06:37:51.715 Copying finished: Transferred: 258,302, Elapsed: 0:00:00, CPS: 7,047,937/s
> 2020-04-08 06:37:51.715 Script: close
. 2020-04-08 06:37:51.715 Closing connection.
. 2020-04-08 06:37:51.715 Sending special code: 1
. 2020-04-08 06:37:51.778 Main session channel closed
. 2020-04-08 06:37:51.778 Remote side unexpectedly closed network connection
< 2020-04-08 06:37:51.778 Script: Active session: [1] **REDACTED**
< 2020-04-08 06:37:51.778 Script: Remote side unexpectedly closed network connection
What could be wrong in this case?
.
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Error "Remote side unexpectedly closed network connectio

Post by FTP »

Could you send your script to us via email?
jhoag
Posts: 15
Joined: Tue Dec 18, 2018 4:21 pm
Location: Newark, NY
Contact:

Re: Error "Remote side unexpectedly closed network connectio

Post by jhoag »

FTP wrote:Could you send your script to us via email?
It's easy to redact the secure info from the script, so here it is:

Code: Select all

# Automatically abort script on errors 
option batch abort 
# Disable overwrite confirmations that conflict with the previous 
option confirm off 
# Connect using a password 
# open sftp://user:password@example.com -hostkey="ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" 
# Connect 

open sftp://*REDACTED*:*REDACTED*@ourwingftpserver.org / -hostkey="*REDACTED*" -rawsettings FSProtocol=2 SendBuf=0 SshSimple=0

# Change remote directory 
#cd /DirectoryName

# Force binary mode transfer 
option transfer binary 

# Upload files to the remote directory  
get -nopreservetime -nopermissions Staff.csv "C:\ISMUtilities\Data\WinCapstaff.csv"
put -nopreservetime -nopermissions "C:\ISMUtilities\Data\newperson.csv"
put -nopreservetime -nopermissions "C:\ISMUtilities\Data\newdepts.csv"
put -nopreservetime -nopermissions "C:\ISMUtilities\Data\newcontactinfo.csv" 

# To delete the local files after FTP use
# put -delete [Your Local Directory]\*.* 
# Disconnect 

close
exit
It's a script with very simple commands...nothing fancy really. The lines that are preceded by a # are comments only and are ignored by WinSCP. Does that help?
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Error "Remote side unexpectedly closed network connectio

Post by FTP »

OK, I just tested with your script, there is no problem.

winscp /script=d:/123.txt

Code: Select all

batch           abort
confirm         off
Searching for host...
Connecting to host...
Authenticating...
Using username "xxx".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Session started.
Active session: [1] xxx@192.168.31.123
/temp
transfer        binary
download.csv              |           1 KB |    0.0 KB/s | binary | 100%
D:\upload1.csv            |           1 KB |    0.0 KB/s | binary | 100%
D:\upload2.csv            |           1 KB |    0.0 KB/s | binary | 100%
D:\upload3.csv            |           1 KB |    0.0 KB/s | binary | 100%
Session 'xxx@192.168.31.123' closed.
No session.
Exit code: 0
Max roundtrip: 0

Only modified something about the open command:

open sftp://xxx:xx@192.168.31.123 -rawsettings FSProtocol=2 SendBuf=0 SshSimple=0
jhoag
Posts: 15
Joined: Tue Dec 18, 2018 4:21 pm
Location: Newark, NY
Contact:

Re: Error "Remote side unexpectedly closed network connectio

Post by jhoag »

You don't need to specify the -hostkey?

I just tried running the script with the modified "Open" command specified, and straight away it returned the usual error. Remember that the error is inconsistent. Two or three tries will fail, and then one might pass.

Here's what WinSCP displays if you run the command from a DOS prompt:
C:\ISMUtilities\Data>"C:\Program Files (x86)\WinSCP\WinSCP.com" /script="C:\ISMUtilities\Data\WinSCPAutomationScript.txt" /log="C:\ISMUtilities\Data\WinSCP.log"
batch abort
confirm off
Searching for host...
Connecting to host...
Authenticating...
Using username "**REDACTED**".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Session started.
Active session: [1] **REDACTED**
transfer binary
Staff.csv | 135 KB | 0.0 KB/s | binary | 100%
C:\...\Data\newperson.csv | 183 B | 0.0 KB/s | binary | 100%
C:\...\Data\newdepts.csv | 483 B | 0.0 KB/s | binary | 100%
C:\...\newcontactinfo.csv | 252 KB | 7097.3 KB/s | binary | 100%
Active session: [1] **REDACTED**
Remote side unexpectedly closed network connection
Session '**REDACTED**' closed.
No session.
Here's the WinSCP Log again if it helps!

Code: Select all

. 2020-04-09 20:25:01.600 --------------------------------------------------------------------------
. 2020-04-09 20:25:01.600 WinSCP Version 5.17.3 (Build 10325) (OS 10.0.14393 - Windows Server 2016 Standard)
. 2020-04-09 20:25:01.600 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2020-04-09 20:25:01.600 Log level: Normal
. 2020-04-09 20:25:01.600 Local account: **REDACTED**
. 2020-04-09 20:25:01.600 Working directory: C:\ISMUtilities\Data
. 2020-04-09 20:25:01.600 Process ID: 4260
. 2020-04-09 20:25:01.600 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" /console=5.17.3 /consoleinstance=_7640_786 "/script=C:\ISMUtilities\Data\WinSCPAutomationScript.txt" "/log=C:\ISMUtilities\Data\WinSCP.log" 
. 2020-04-09 20:25:01.600 Time zone: Current: GMT-4, Standard: GMT-5 (Eastern Standard Time), DST: GMT-4 (Eastern Daylight Time), DST Start: 3/8/2020, DST End: 11/1/2020
. 2020-04-09 20:25:01.600 Login time: Thursday, April 9, 2020 8:25:01 PM
. 2020-04-09 20:25:01.600 --------------------------------------------------------------------------
. 2020-04-09 20:25:01.600 Script: Retrospectively logging previous script records:
> 2020-04-09 20:25:01.600 Script: option batch abort 
< 2020-04-09 20:25:01.600 Script: batch           abort     
> 2020-04-09 20:25:01.600 Script: option confirm off 
< 2020-04-09 20:25:01.600 Script: confirm         off       
> 2020-04-09 20:25:01.600 Script: open sftp://**REDACTED**/ -rawsettings FSProtocol=2 SendBuf=0 SshSimple=0
. 2020-04-09 20:25:01.600 --------------------------------------------------------------------------
. 2020-04-09 20:25:01.600 Session name: **REDACTED** (Ad-Hoc site)
. 2020-04-09 20:25:01.600 Host name: **REDACTED** (Port: 22)
. 2020-04-09 20:25:01.600 User name: **REDACTED** (Password: Yes, Key file: No, Passphrase: No)
. 2020-04-09 20:25:01.600 Tunnel: No
. 2020-04-09 20:25:01.600 Transfer Protocol: SFTP
. 2020-04-09 20:25:01.600 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2020-04-09 20:25:01.600 Disable Nagle: No
. 2020-04-09 20:25:01.600 Proxy: None
. 2020-04-09 20:25:01.600 Send buffer: 0
. 2020-04-09 20:25:01.600 SSH protocol version: 2; Compression: No
. 2020-04-09 20:25:01.600 Bypass authentication: No
. 2020-04-09 20:25:01.600 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: Yes
. 2020-04-09 20:25:01.600 GSSAPI: Forwarding: No; Libs: gssapi32,sspi,custom; Custom: 
. 2020-04-09 20:25:01.600 Ciphers: aes,chacha20,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2020-04-09 20:25:01.600 KEX: ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2020-04-09 20:25:01.600 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2020-04-09 20:25:01.600 Simple channel: No
. 2020-04-09 20:25:01.600 Return code variable: Autodetect; Lookup user groups: Auto
. 2020-04-09 20:25:01.600 Shell: default
. 2020-04-09 20:25:01.600 EOL: LF, UTF: Auto
. 2020-04-09 20:25:01.600 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2020-04-09 20:25:01.600 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No; Exit code 1 is error: No
. 2020-04-09 20:25:01.600 SFTP Bugs: Auto,Auto
. 2020-04-09 20:25:01.600 SFTP Server: default
. 2020-04-09 20:25:01.600 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2020-04-09 20:25:01.600 Cache directory changes: Yes, Permanent: Yes
. 2020-04-09 20:25:01.600 Recycle bin: Delete to: No, Overwritten to: No, Bin path: 
. 2020-04-09 20:25:01.600 DST mode: Unix
. 2020-04-09 20:25:01.600 --------------------------------------------------------------------------
. 2020-04-09 20:25:01.600 Looking up host "**REDACTED**" for SSH connection
. 2020-04-09 20:25:01.615 Connecting to **REDACTED** port 22
. 2020-04-09 20:25:01.615 We claim version: SSH-2.0-WinSCP_release_5.17.3
. 2020-04-09 20:25:01.615 Remote version: SSH-2.0-WingFTPServer
. 2020-04-09 20:25:01.615 Using SSH protocol version 2
. 2020-04-09 20:25:01.615 No GSSAPI security context available
. 2020-04-09 20:25:01.615 Have a known host key of type ecdsa-sha2-nistp256
. 2020-04-09 20:25:01.615 Doing ECDH key exchange with curve Curve25519 and hash SHA-256
. 2020-04-09 20:25:01.694 Server also has ssh-rsa host key, but we don't know it
. 2020-04-09 20:25:01.694 Host key fingerprint is:
. 2020-04-09 20:25:01.694 **REDACTED**
. 2020-04-09 20:25:01.694 Host key matches cached key
. 2020-04-09 20:25:01.694 Initialised AES-256 SDCTR (AES-NI accelerated) outbound encryption
. 2020-04-09 20:25:01.694 Initialised HMAC-SHA-256 outbound MAC algorithm
. 2020-04-09 20:25:01.694 Initialised AES-256 SDCTR (AES-NI accelerated) inbound encryption
. 2020-04-09 20:25:01.694 Initialised HMAC-SHA-256 inbound MAC algorithm
! 2020-04-09 20:25:01.725 Using username "**REDACTED**".
. 2020-04-09 20:25:01.725 Server offered these authentication methods: publickey,password
. 2020-04-09 20:25:01.725 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2020-04-09 20:25:01.725 Using stored password.
. 2020-04-09 20:25:01.725 Sent password
. 2020-04-09 20:25:01.725 Access granted
. 2020-04-09 20:25:01.725 Opening main session channel
. 2020-04-09 20:25:01.725 Opened main channel
. 2020-04-09 20:25:01.725 Started a shell/command
. 2020-04-09 20:25:01.725 --------------------------------------------------------------------------
. 2020-04-09 20:25:01.725 Using SFTP protocol.
. 2020-04-09 20:25:01.725 Doing startup conversation with host.
> 2020-04-09 20:25:01.725 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2020-04-09 20:25:01.756 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2020-04-09 20:25:01.756 SFTP version 3 negotiated.
. 2020-04-09 20:25:01.756 We believe the server has signed timestamps bug
. 2020-04-09 20:25:01.756 We will use UTF-8 strings until server sends an invalid UTF-8 string as with SFTP version 3 and older UTF-8 strings are not mandatory
. 2020-04-09 20:25:01.756 Getting current directory name.
. 2020-04-09 20:25:01.756 Getting real path for '.'
> 2020-04-09 20:25:01.756 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2020-04-09 20:25:01.756 Type: SSH_FXP_NAME, Size: 23, Number: 16
. 2020-04-09 20:25:01.756 Real path is '/'
. 2020-04-09 20:25:01.756 Startup conversation with host finished.
< 2020-04-09 20:25:01.756 Script: Active session: [1] **REDACTED**
> 2020-04-09 20:25:01.756 Script: option transfer binary 
< 2020-04-09 20:25:01.756 Script: transfer        binary    
> 2020-04-09 20:25:01.756 Script: get -nopreservetime -nopermissions Staff.csv "C:\ISMUtilities\Data\WinCapstaff.csv"
. 2020-04-09 20:25:01.756 Listing file "Staff.csv".
> 2020-04-09 20:25:01.756 Type: SSH_FXP_LSTAT, Size: 19, Number: 263
< 2020-04-09 20:25:01.756 Type: SSH_FXP_ATTRS, Size: 37, Number: 263
. 2020-04-09 20:25:01.756 Staff.csv;-;138770;2020-04-09T13:02:51.000Z;3;"" [0];"" [0];rw-rw-rw-;1
. 2020-04-09 20:25:01.756 Copying 1 files/directories to local directory "C:\ISMUtilities\Data\" - total size: 138,770
. 2020-04-09 20:25:01.756   PrTime: No; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask: WinCapstaff.csv
. 2020-04-09 20:25:01.756   TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; EncryptNewFiles: Yes; ExcludeHiddenFiles: No; ExcludeEmptyDirectories: No; InclM: ; ResumeL: 0
. 2020-04-09 20:25:01.756   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2020-04-09 20:25:01.756 File: '/Staff.csv' [2020-04-09T13:02:51.000Z] [138770]
. 2020-04-09 20:25:01.756 Copying "/Staff.csv" to local directory started.
. 2020-04-09 20:25:01.756 Binary transfer mode selected.
. 2020-04-09 20:25:01.756 Checking existence of partially transferred file.
. 2020-04-09 20:25:01.756 Opening remote file.
> 2020-04-09 20:25:01.756 Type: SSH_FXP_OPEN, Size: 27, Number: 515
< 2020-04-09 20:25:01.756 Type: SSH_FXP_HANDLE, Size: 21, Number: 515
> 2020-04-09 20:25:01.756 Type: SSH_FXP_FSTAT, Size: 21, Number: 776
< 2020-04-09 20:25:01.756 Type: SSH_FXP_ATTRS, Size: 37, Number: 776
. 2020-04-09 20:25:01.756 Confirming overwriting of file.
> 2020-04-09 20:25:01.756 Type: SSH_FXP_READ, Size: 33, Number: 1029
< 2020-04-09 20:25:01.756 Status code: 1
. 2020-04-09 20:25:01.756 15 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2020-04-09 20:25:01.756 Type: SSH_FXP_CLOSE, Size: 21, Number: 3588
< 2020-04-09 20:25:01.756 Type: SSH_FXP_STATUS, Size: 47, Number: 2565
< 2020-04-09 20:25:01.756 Type: SSH_FXP_STATUS, Size: 47, Number: 2821
< 2020-04-09 20:25:01.756 Type: SSH_FXP_STATUS, Size: 47, Number: 3077
< 2020-04-09 20:25:01.756 Type: SSH_FXP_STATUS, Size: 47, Number: 3333
. 2020-04-09 20:25:01.756 Transfer done: '/Staff.csv' => 'C:\ISMUtilities\Data\WinCapstaff.csv' [138770]
. 2020-04-09 20:25:01.756 Copying finished: Transferred: 138,770, Elapsed: 0:00:00, CPS: 0/s
> 2020-04-09 20:25:01.756 Script: put -nopreservetime -nopermissions "C:\ISMUtilities\Data\newperson.csv"
. 2020-04-09 20:25:01.756 Copying 1 files/directories to remote directory "/" - total size: 183
. 2020-04-09 20:25:01.756   PrTime: No; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask: 
. 2020-04-09 20:25:01.756   TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; EncryptNewFiles: Yes; ExcludeHiddenFiles: No; ExcludeEmptyDirectories: No; InclM: ; ResumeL: 0
. 2020-04-09 20:25:01.756   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2020-04-09 20:25:01.756 Getting real path for '/'
> 2020-04-09 20:25:01.756 Type: SSH_FXP_REALPATH, Size: 10, Number: 3856
< 2020-04-09 20:25:01.756 Type: SSH_FXP_STATUS, Size: 17, Number: 3588
. 2020-04-09 20:25:01.756 Discarding reserved response
< 2020-04-09 20:25:01.756 Type: SSH_FXP_NAME, Size: 23, Number: 3856
. 2020-04-09 20:25:01.756 Real path is '/'
. 2020-04-09 20:25:01.756 File: 'C:\ISMUtilities\Data\newperson.csv' [2020-04-09T06:00:21.631Z] [183]
. 2020-04-09 20:25:01.756 Copying "C:\ISMUtilities\Data\newperson.csv" to remote directory started.
. 2020-04-09 20:25:01.756 Binary transfer mode selected.
. 2020-04-09 20:25:01.756 Opening remote file.
> 2020-04-09 20:25:01.756 Type: SSH_FXP_OPEN, Size: 39, Number: 4099
< 2020-04-09 20:25:01.756 Type: SSH_FXP_HANDLE, Size: 25, Number: 4099
> 2020-04-09 20:25:01.756 Type: SSH_FXP_WRITE, Size: 220, Number: 4614
> 2020-04-09 20:25:01.756 Type: SSH_FXP_CLOSE, Size: 25, Number: 4868
< 2020-04-09 20:25:01.772 Type: SSH_FXP_STATUS, Size: 25, Number: 4614
< 2020-04-09 20:25:01.772 Status code: 0
< 2020-04-09 20:25:01.772 Type: SSH_FXP_STATUS, Size: 17, Number: 4868
< 2020-04-09 20:25:01.772 Status code: 0
. 2020-04-09 20:25:01.772 Transfer done: 'C:\ISMUtilities\Data\newperson.csv' => '/newperson.csv' [183]
. 2020-04-09 20:25:01.772 Copying finished: Transferred: 183, Elapsed: 0:00:00, CPS: 0/s
> 2020-04-09 20:25:01.772 Script: put -nopreservetime -nopermissions "C:\ISMUtilities\Data\newdepts.csv"
. 2020-04-09 20:25:01.772 Copying 1 files/directories to remote directory "/" - total size: 483
. 2020-04-09 20:25:01.772   PrTime: No; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask: 
. 2020-04-09 20:25:01.772   TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; EncryptNewFiles: Yes; ExcludeHiddenFiles: No; ExcludeEmptyDirectories: No; InclM: ; ResumeL: 0
. 2020-04-09 20:25:01.772   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2020-04-09 20:25:01.772 Getting real path for '/'
> 2020-04-09 20:25:01.772 Type: SSH_FXP_REALPATH, Size: 10, Number: 5136
< 2020-04-09 20:25:01.772 Type: SSH_FXP_NAME, Size: 23, Number: 5136
. 2020-04-09 20:25:01.772 Real path is '/'
. 2020-04-09 20:25:01.772 File: 'C:\ISMUtilities\Data\newdepts.csv' [2020-04-09T06:00:21.631Z] [483]
. 2020-04-09 20:25:01.772 Copying "C:\ISMUtilities\Data\newdepts.csv" to remote directory started.
. 2020-04-09 20:25:01.772 Binary transfer mode selected.
. 2020-04-09 20:25:01.772 Opening remote file.
> 2020-04-09 20:25:01.772 Type: SSH_FXP_OPEN, Size: 38, Number: 5379
< 2020-04-09 20:25:01.772 Type: SSH_FXP_HANDLE, Size: 24, Number: 5379
> 2020-04-09 20:25:01.772 Type: SSH_FXP_WRITE, Size: 519, Number: 5894
> 2020-04-09 20:25:01.772 Type: SSH_FXP_CLOSE, Size: 24, Number: 6148
< 2020-04-09 20:25:01.772 Type: SSH_FXP_STATUS, Size: 25, Number: 5894
< 2020-04-09 20:25:01.772 Status code: 0
< 2020-04-09 20:25:01.772 Type: SSH_FXP_STATUS, Size: 17, Number: 6148
< 2020-04-09 20:25:01.772 Status code: 0
. 2020-04-09 20:25:01.772 Transfer done: 'C:\ISMUtilities\Data\newdepts.csv' => '/newdepts.csv' [483]
. 2020-04-09 20:25:01.772 Copying finished: Transferred: 483, Elapsed: 0:00:00, CPS: 0/s
> 2020-04-09 20:25:01.772 Script: put -nopreservetime -nopermissions "C:\ISMUtilities\Data\newcontactinfo.csv" 
. 2020-04-09 20:25:01.772 Copying 1 files/directories to remote directory "/" - total size: 258,064
. 2020-04-09 20:25:01.772   PrTime: No; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask: 
. 2020-04-09 20:25:01.772   TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; EncryptNewFiles: Yes; ExcludeHiddenFiles: No; ExcludeEmptyDirectories: No; InclM: ; ResumeL: 0
. 2020-04-09 20:25:01.772   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2020-04-09 20:25:01.772 Getting real path for '/'
> 2020-04-09 20:25:01.772 Type: SSH_FXP_REALPATH, Size: 10, Number: 6416
< 2020-04-09 20:25:01.772 Type: SSH_FXP_NAME, Size: 23, Number: 6416
. 2020-04-09 20:25:01.772 Real path is '/'
. 2020-04-09 20:25:01.772 File: 'C:\ISMUtilities\Data\newcontactinfo.csv' [2020-04-09T06:00:21.756Z] [258064]
. 2020-04-09 20:25:01.772 Copying "C:\ISMUtilities\Data\newcontactinfo.csv" to remote directory started.
. 2020-04-09 20:25:01.772 Binary transfer mode selected.
. 2020-04-09 20:25:01.772 Checking existence of file.
> 2020-04-09 20:25:01.772 Type: SSH_FXP_LSTAT, Size: 28, Number: 6663
< 2020-04-09 20:25:01.772 Type: SSH_FXP_ATTRS, Size: 37, Number: 6663
. 2020-04-09 20:25:01.772 File exists: newcontactinfo.csv;-;258064;2020-04-10T00:24:48.000Z;3;"" [0];"" [0];rw-rw-rw-;1
. 2020-04-09 20:25:01.772 Checking existence of partially transferred file.
> 2020-04-09 20:25:01.772 Type: SSH_FXP_LSTAT, Size: 37, Number: 6919
< 2020-04-09 20:25:01.772 Type: SSH_FXP_STATUS, Size: 32, Number: 6919
< 2020-04-09 20:25:01.772 Status code: 2
. 2020-04-09 20:25:01.772 Opening remote file.
> 2020-04-09 20:25:01.772 Type: SSH_FXP_OPEN, Size: 53, Number: 7171
< 2020-04-09 20:25:01.772 Type: SSH_FXP_HANDLE, Size: 39, Number: 7171
> 2020-04-09 20:25:01.772 Type: SSH_FXP_WRITE, Size: 32819, Number: 7686
. 2020-04-09 20:25:01.772 7 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2020-04-09 20:25:01.772 Type: SSH_FXP_CLOSE, Size: 39, Number: 9732
< 2020-04-09 20:25:01.772 Type: SSH_FXP_STATUS, Size: 25, Number: 7686
< 2020-04-09 20:25:01.772 Status code: 0
< 2020-04-09 20:25:01.772 Type: SSH_FXP_STATUS, Size: 25, Number: 7942
< 2020-04-09 20:25:01.772 Status code: 0
< 2020-04-09 20:25:01.772 Type: SSH_FXP_STATUS, Size: 25, Number: 8198
< 2020-04-09 20:25:01.772 Status code: 0
< 2020-04-09 20:25:01.803 Type: SSH_FXP_STATUS, Size: 25, Number: 8454
< 2020-04-09 20:25:01.803 Status code: 0
< 2020-04-09 20:25:01.803 Type: SSH_FXP_STATUS, Size: 25, Number: 8710
< 2020-04-09 20:25:01.803 Status code: 0
< 2020-04-09 20:25:01.803 Type: SSH_FXP_STATUS, Size: 25, Number: 8966
< 2020-04-09 20:25:01.803 Status code: 0
< 2020-04-09 20:25:01.803 Type: SSH_FXP_STATUS, Size: 25, Number: 9222
< 2020-04-09 20:25:01.803 Status code: 0
< 2020-04-09 20:25:01.803 Type: SSH_FXP_STATUS, Size: 25, Number: 9478
< 2020-04-09 20:25:01.803 Status code: 0
< 2020-04-09 20:25:01.803 Type: SSH_FXP_STATUS, Size: 17, Number: 9732
< 2020-04-09 20:25:01.803 Status code: 0
> 2020-04-09 20:25:01.803 Type: SSH_FXP_REMOVE, Size: 28, Number: 9997
< 2020-04-09 20:25:01.803 Type: SSH_FXP_STATUS, Size: 43, Number: 9997
< 2020-04-09 20:25:01.803 Status code: 0
> 2020-04-09 20:25:01.803 Type: SSH_FXP_RENAME, Size: 60, Number: 10258
< 2020-04-09 20:25:01.803 Type: SSH_FXP_STATUS, Size: 42, Number: 10258
< 2020-04-09 20:25:01.803 Status code: 0
> 2020-04-09 20:25:01.803 Type: SSH_FXP_SETSTAT, Size: 36, Number: 7433
< 2020-04-09 20:25:01.803 Type: SSH_FXP_STATUS, Size: 48, Number: 7433
< 2020-04-09 20:25:01.803 Status code: 0
. 2020-04-09 20:25:01.803 Transfer done: 'C:\ISMUtilities\Data\newcontactinfo.csv' => '/newcontactinfo.csv' [258064]
. 2020-04-09 20:25:01.803 Copying finished: Transferred: 258,064, Elapsed: 0:00:00, CPS: 7,267,612/s
> 2020-04-09 20:25:01.803 Script: close
. 2020-04-09 20:25:01.803 Closing connection.
. 2020-04-09 20:25:01.803 Sending special code: 1
. 2020-04-09 20:25:01.850 Main session channel closed
. 2020-04-09 20:25:01.850 Remote side unexpectedly closed network connection
< 2020-04-09 20:25:01.850 Script: Active session: [1] **REDACTED**
< 2020-04-09 20:25:01.850 Script: Remote side unexpectedly closed network connection
Last edited by jhoag on Tue Apr 14, 2020 1:12 pm, edited 1 time in total.
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Error "Remote side unexpectedly closed network connectio

Post by FTP »

If you don't specify the parameter "hostkey", winscp will ask you whether accept the host key, so it doesn't matter.

And I tested with Wing FTP Server v6.2.9 and WinSCP v5.15.4, so maybe it is caused by the new version of WinSCP?
jhoag
Posts: 15
Joined: Tue Dec 18, 2018 4:21 pm
Location: Newark, NY
Contact:

Re: Error "Remote side unexpectedly closed network connectio

Post by jhoag »

FTP wrote:If you don't specify the parameter "hostkey", winscp will ask you whether accept the host key, so it doesn't matter.

And I tested with Wing FTP Server v6.2.9 and WinSCP v5.15.4, so maybe it is caused by the new version of WinSCP?

Certainly something I've been suspecting for awhile now. Do you have any partnership with them though, or would it be possible for you to contact them to determine why WinSCP might not work with your product? It would certainly be disappointing for us to have to reengineer our entire set of data transfer processes to either abandon WinSCP or abandon WingFTP.

We certainly get pressure from our Network Support Team to leave WingFTP. Any extra help that you can give to help us avoid that common suggestion as a solution, would be great!
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Error "Remote side unexpectedly closed network connectio

Post by FTP »

OK, I just tested with the latest version of WinSCP, the result is also fine.
In your client logs, I noticed that there is a line "Script: close" before closing SFTP connection, obviously, the client side (script) requested the SFTP quit command.
I doubt such issue was caused by your firewall or something else, because I found a similar issue in WinSCP's forum: https://winscp.net/forum/viewtopic.php?t=28293
jhoag
Posts: 15
Joined: Tue Dec 18, 2018 4:21 pm
Location: Newark, NY
Contact:

Re: Error "Remote side unexpectedly closed network connectio

Post by jhoag »

FTP wrote:OK, I just tested with the latest version of WinSCP, the result is also fine.
In your client logs, I noticed that there is a line "Script: close" before closing SFTP connection, obviously, the client side (script) requested the SFTP quit command.
I doubt such issue was caused by your firewall or something else, because I found a similar issue in WinSCP's forum: https://winscp.net/forum/viewtopic.php?t=28293
In response to your post, I've submitted the following post in WinSCP's Support Forum:
https://winscp.net/forum/viewtopic.php?t=29180

After doing so, I did some more exploring on WinSCP's site, and this article seems to be most relevant:
https://winscp.net/eng/docs/message_unexpected_close

However, the posts that I see on WinSCP regarding this type of problem, all seem to suggest that we check the logs on the WingFTP server to see what they are showing when a disconnect occurs. Can you tell me which logs to look at and where to do so on the WingFTP server?

Also, I discovered if I use the WinSCP client to connect to our WingFTP site (not the script) and then simply click the X to close the application after connecting to our WingFTP server (doing nothing more than connect and close), I get this error on screen pretty consistently:

Image

Let me know what other detail I can provide!
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Error "Remote side unexpectedly closed network connectio

Post by FTP »

OK, it seems that is a bug really, so please upgrade to the latest version 6.3.0, I think the new version already fixed it.
Post Reply