Every few days, my script keeps failing and pages me because it was unable to connect to the host. I read all the possibilities off this website and I can rule out anything to do with my network, or firewall.
Here is what happens:
1) The script below works fine most of the time, it is set to run in a batch file once a day. On certain days, it just fails to connect no matter how many times I set it to retry in a DOS batch loop. I run the script like so: winscp.exe /console /script=script.scp. The error I get is " Network error: Software caused connection abort". I have searched and tried every single recommendation on this site to resolve this issue but I am not able to. I strongly suspect it has something to do with running through the console.
2) For whatever reason, since day one, it never connects on the first try, it always takes the 2nd try to connect whether it's through the WinSCP GUI, or through the script.
3) What is strange is that I am ALWAYS able to connect using the GUI on the 2nd try (Reconnect) after it tells me " Network error: Software caused connection abort" on the first try.
3) Why is this? Why can I connect through the GUI, but no matter how many times I try, the console script won't work?
option batch ignore
option confirm off
option echo on
option transfer ascii
open Moneris
get -preservetime *ASDF* D:\Files\
get -preservetime *TEST* D:\Files\
option transfer binary
get -preservetime *TESTBIN* D:\Files\
close
exit
Log file when the script just doesn't connect:
. 2009-12-05 16:55:19.728 --------------------------------------------------------------------------
. 2009-12-05 16:55:19.728 WinSCP Version 4.1.9 (Build 416) (OS 5.2.3790 Service Pack 2)
. 2009-12-05 16:55:19.728 Login time: December 5, 2009 4:55:19 PM
. 2009-12-05 16:55:19.728 --------------------------------------------------------------------------
. 2009-12-05 16:55:19.728 Session name: Test
. 2009-12-05 16:55:19.728 Host name: 1.2.3.4 (Port: 22)
. 2009-12-05 16:55:19.728 User name: 008 (Password: Yes, Key file: No)
. 2009-12-05 16:55:19.728 Tunnel: No
. 2009-12-05 16:55:19.728 Transfer Protocol: SFTP (SCP)
. 2009-12-05 16:55:19.728 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2009-12-05 16:55:19.728 Proxy: none
. 2009-12-05 16:55:19.728 SSH protocol version: 2; Compression: No
. 2009-12-05 16:55:19.728 Bypass authentication: No
. 2009-12-05 16:55:19.728 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2009-12-05 16:55:19.728 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2009-12-05 16:55:19.728 SSH Bugs: -,-,-,-,-,-,-,-
. 2009-12-05 16:55:19.728 SFTP Bugs: -,-
. 2009-12-05 16:55:19.728 Return code variable: Autodetect; Lookup user groups: Yes
. 2009-12-05 16:55:19.728 Shell: default, EOL: 0
. 2009-12-05 16:55:19.728 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2009-12-05 16:55:19.728 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2009-12-05 16:55:19.728 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2009-12-05 16:55:19.728 Cache directory changes: Yes, Permanent: Yes
. 2009-12-05 16:55:19.728 DST mode: 1
. 2009-12-05 16:55:19.728 --------------------------------------------------------------------------
. 2009-12-05 16:55:19.759 Looking up host "1.2.3.4"
. 2009-12-05 16:55:19.759 Connecting to 1.2.3.4 port 22
. 2009-12-05 16:55:19.775 Waiting for the server to continue with the initialisation
. 2009-12-05 16:55:19.775 Detected network event
. 2009-12-05 16:55:19.775 Detected network event
. 2009-12-05 16:55:19.775 Server version: SSH-2.0-SSHD
. 2009-12-05 16:55:19.775 We claim version: SSH-2.0-WinSCP_release_4.1.9
. 2009-12-05 16:55:19.790 SSPI: acquired credentials for: TEST@TEST.COM
. 2009-12-05 16:55:19.790 Cannot convert IP address to SPN: DNS is not trusted
. 2009-12-05 16:55:19.868 GSSKEX disabled:
. 2009-12-05 16:55:19.868 Using SSH protocol version 2
. 2009-12-05 16:55:19.868 Waiting for the server to continue with the initialisation
. 2009-12-05 16:55:19.868 Detected network event
. 2009-12-05 16:55:19.868 Using Diffie-Hellman with standard group "group14"
. 2009-12-05 16:55:19.868 Doing Diffie-Hellman key exchange with hash SHA-1
. 2009-12-05 16:55:19.931 Waiting for the server to continue with the initialisation
. 2009-12-05 16:55:19.931 Detected network event
. 2009-12-05 16:55:19.931 Network error: Software caused connection abort
* 2009-12-05 16:55:19.931 (ESshFatal) Network error: Software caused connection abort
Here is the log when I connect through the GUI (double click on the session name, it tries to connect, tells me Software caused connection abort, then I click on Reconnect, and it always connects that time:
. 2009-12-05 16:55:25.743 --------------------------------------------------------------------------
. 2009-12-05 16:55:25.743 WinSCP Version 4.1.9 (Build 416) (OS 5.2.3790 Service Pack 2)
. 2009-12-05 16:55:25.743 Login time: December 5, 2009 4:55:25 PM
. 2009-12-05 16:55:25.743 --------------------------------------------------------------------------
. 2009-12-05 16:55:25.743 Session name: Test
. 2009-12-05 16:55:25.743 Host name: 1.2.3.4 (Port: 22)
. 2009-12-05 16:55:25.743 User name: 008 (Password: Yes, Key file: No)
. 2009-12-05 16:55:25.743 Tunnel: No
. 2009-12-05 16:55:25.743 Transfer Protocol: SFTP (SCP)
. 2009-12-05 16:55:25.743 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2009-12-05 16:55:25.743 Proxy: none
. 2009-12-05 16:55:25.743 SSH protocol version: 2; Compression: No
. 2009-12-05 16:55:25.743 Bypass authentication: No
. 2009-12-05 16:55:25.743 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2009-12-05 16:55:25.743 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2009-12-05 16:55:25.743 SSH Bugs: -,-,-,-,-,-,-,-
. 2009-12-05 16:55:25.743 SFTP Bugs: -,-
. 2009-12-05 16:55:25.743 Return code variable: Autodetect; Lookup user groups: Yes
. 2009-12-05 16:55:25.743 Shell: default, EOL: 0
. 2009-12-05 16:55:25.743 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2009-12-05 16:55:25.743 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2009-12-05 16:55:25.743 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2009-12-05 16:55:25.743 Cache directory changes: Yes, Permanent: Yes
. 2009-12-05 16:55:25.743 DST mode: 1
. 2009-12-05 16:55:25.743 --------------------------------------------------------------------------
. 2009-12-05 16:55:25.759 Looking up host "1.2.3.4"
. 2009-12-05 16:55:25.759 Connecting to 1.2.3.4 port 22
. 2009-12-05 16:55:25.775 Waiting for the server to continue with the initialisation
. 2009-12-05 16:55:25.775 Detected network event
. 2009-12-05 16:55:25.790 Detected network event
. 2009-12-05 16:55:25.790 Server version: SSH-2.0-SSHD
. 2009-12-05 16:55:25.790 We claim version: SSH-2.0-WinSCP_release_4.1.9
. 2009-12-05 16:55:25.790 SSPI: acquired credentials for: TEST@TEST.COM
. 2009-12-05 16:55:25.790 Cannot convert IP address to SPN: DNS is not trusted
. 2009-12-05 16:55:25.790 GSSKEX disabled: The operation completed successfully.
. 2009-12-05 16:55:25.790 Using SSH protocol version 2
. 2009-12-05 16:55:25.790 Waiting for the server to continue with the initialisation
. 2009-12-05 16:55:25.806 Detected network event
. 2009-12-05 16:55:25.806 Using Diffie-Hellman with standard group "group14"
. 2009-12-05 16:55:25.806 Doing Diffie-Hellman key exchange with hash SHA-1
. 2009-12-05 16:55:25.853 Waiting for the server to continue with the initialisation
. 2009-12-05 16:55:26.212 Detected network event
. 2009-12-05 16:55:26.275 Host key fingerprint is:
. 2009-12-05 16:55:26.275 ssh-rsa 2048 36:3f:12:e5:e7:47:7e:d4:29:4a:e2:83:93:70:79:c3
. 2009-12-05 16:55:26.275 Initialised AES-256 CBC client->server encryption
. 2009-12-05 16:55:26.275 Initialised HMAC-SHA1 client->server MAC algorithm
. 2009-12-05 16:55:26.275 Initialised AES-256 CBC server->client encryption
. 2009-12-05 16:55:26.275 Initialised HMAC-SHA1 server->client MAC algorithm
. 2009-12-05 16:55:26.275 Waiting for the server to continue with the initialisation
. 2009-12-05 16:55:26.306 Detected network event
! 2009-12-05 16:55:26.306 Using username "008".
. 2009-12-05 16:55:26.306 Waiting for the server to continue with the initialisation
. 2009-12-05 16:55:26.306 Detected network event
. 2009-12-05 16:55:26.306 Waiting for the server to continue with the initialisation
. 2009-12-05 16:55:26.321 Detected network event
. 2009-12-05 16:55:26.321 Waiting for the server to continue with the initialisation
. 2009-12-05 16:55:26.321 Detected network event
. 2009-12-05 16:55:26.321 Prompt (5, SSH server: Password Authentication, Using keyboard-interactive authentication., Password: )
. 2009-12-05 16:55:26.321 Using stored password.
. 2009-12-05 16:55:26.337 Waiting for the server to continue with the initialisation
. 2009-12-05 16:55:26.493 Detected network event
. 2009-12-05 16:55:26.493 Access granted
. 2009-12-05 16:55:26.493 Waiting for the server to continue with the initialisation
. 2009-12-05 16:55:26.493 Detected network event
. 2009-12-05 16:55:26.493 Opened channel for session
. 2009-12-05 16:55:26.493 Waiting for the server to continue with the initialisation
. 2009-12-05 16:55:26.634 Detected network event
. 2009-12-05 16:55:26.634 Started a shell/command
. 2009-12-05 16:55:26.634 --------------------------------------------------------------------------
. 2009-12-05 16:55:26.634 Using SFTP protocol.
. 2009-12-05 16:55:26.634 Doing startup conversation with host.
> 2009-12-05 16:55:26.634 Type: SSH_FXP_INIT, Size: 5, Number: -1
. 2009-12-05 16:55:26.634 Sent 9 bytes
. 2009-12-05 16:55:26.634 There are 9 bytes remaining in the send buffer
. 2009-12-05 16:55:26.634 Detected network event
. 2009-12-05 16:55:26.634 Waiting for another 4 bytes
. 2009-12-05 16:55:26.650 Detected network event
. 2009-12-05 16:55:26.650 Received 9 bytes (0)
. 2009-12-05 16:55:26.650 Read 4 bytes (5 pending)
. 2009-12-05 16:55:26.650 Read 5 bytes (0 pending)
< 2009-12-05 16:55:26.650 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2009-12-05 16:55:26.650 SFTP version 3 negotiated.
. 2009-12-05 16:55:26.650 We believe the server has signed timestamps bug
. 2009-12-05 16:55:26.650 We will use UTF-8 strings for status messages only
. 2009-12-05 16:55:26.650 Getting current directory name.
. 2009-12-05 16:55:26.650 Getting real path for '.'
> 2009-12-05 16:55:26.650 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
. 2009-12-05 16:55:26.650 Sent 14 bytes
. 2009-12-05 16:55:26.650 There are 0 bytes remaining in the send buffer
. 2009-12-05 16:55:26.650 Waiting for another 4 bytes
. 2009-12-05 16:55:26.759 Detected network event
. 2009-12-05 16:55:26.759 Received 47 bytes (0)
. 2009-12-05 16:55:26.759 Read 4 bytes (43 pending)
. 2009-12-05 16:55:26.759 Read 43 bytes (0 pending)
< 2009-12-05 16:55:26.759 Type: SSH_FXP_NAME, Size: 43, Number: 16
. 2009-12-05 16:55:26.759 Real path is '/'
. 2009-12-05 16:55:26.759 Listing directory "/".
> 2009-12-05 16:55:26.759 Type: SSH_FXP_OPENDIR, Size: 10, Number: 267
. 2009-12-05 16:55:26.759 Sent 14 bytes
. 2009-12-05 16:55:26.759 There are 0 bytes remaining in the send buffer
. 2009-12-05 16:55:26.759 Waiting for another 4 bytes
. 2009-12-05 16:55:26.868 Detected network event
. 2009-12-05 16:55:26.868 Received 14 bytes (0)
. 2009-12-05 16:55:26.868 Read 4 bytes (10 pending)
. 2009-12-05 16:55:26.868 Read 10 bytes (0 pending)
< 2009-12-05 16:55:26.868 Type: SSH_FXP_HANDLE, Size: 10, Number: 267
> 2009-12-05 16:55:26.868 Type: SSH_FXP_READDIR, Size: 10, Number: 524
. 2009-12-05 16:55:26.868 Sent 14 bytes
. 2009-12-05 16:55:26.868 There are 0 bytes remaining in the send buffer
. 2009-12-05 16:55:26.868 Waiting for another 4 bytes
. 2009-12-05 16:55:26.884 Detected network event
. 2009-12-05 16:55:26.884 Received 1508 bytes (0)
. 2009-12-05 16:55:26.884 Read 4 bytes (1504 pending)
. 2009-12-05 16:55:26.884 Read 1504 bytes (0 pending)
< 2009-12-05 16:55:26.884 Type: SSH_FXP_NAME, Size: 1504, Number: 524
> 2009-12-05 16:55:26.884 Type: SSH_FXP_READDIR, Size: 10, Number: 780
. 2009-12-05 16:55:26.884 Sent 14 bytes
. 2009-12-05 16:55:26.884 There are 0 bytes remaining in the send buffer
. 2009-12-05 16:55:26.884 Read file '.' from listing
. 2009-12-05 16:55:26.884 Read file '..' from listing
. 2009-12-05 16:55:26.884 Read file 'V10.CSV' from listing
. 2009-12-05 16:55:26.884 Waiting for another 4 bytes
. 2009-12-05 16:55:26.900 Detected network event
. 2009-12-05 16:55:26.900 Received 21 bytes (0)
. 2009-12-05 16:55:26.900 Read 4 bytes (17 pending)
. 2009-12-05 16:55:26.900 Read 17 bytes (0 pending)
< 2009-12-05 16:55:26.900 Type: SSH_FXP_STATUS, Size: 17, Number: 780
< 2009-12-05 16:55:26.900 Status/error code: 1
> 2009-12-05 16:55:26.900 Type: SSH_FXP_CLOSE, Size: 10, Number: 1028
. 2009-12-05 16:55:26.900 Sent 14 bytes
. 2009-12-05 16:55:26.900 There are 0 bytes remaining in the send buffer
. 2009-12-05 16:55:26.900 Startup conversation with host finished.
. 2009-12-05 16:55:27.587 Session upkeep
. 2009-12-05 16:55:27.587 Detected network event
. 2009-12-05 16:55:27.587 Received 44 bytes (0)
. 2009-12-05 16:55:28.087 Session upkeep
. 2009-12-05 16:55:28.587 Session upkeep
. 2009-12-05 16:55:29.087 Session upkeep
. 2009-12-05 16:55:29.587 Session upkeep
. 2009-12-05 16:55:30.087 Session upkeep
. 2009-12-05 16:55:30.587 Session upkeep
. 2009-12-05 16:55:31.087 Session upkeep
. 2009-12-05 16:55:31.587 Session upkeep
. 2009-12-05 16:55:32.056 Closing connection.
. 2009-12-05 16:55:32.056 Sending special code: 12
. 2009-12-05 16:55:32.056 Sent EOF message