Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Windows 10 FTP transfer connection failed

Thanks for sharing your findings.
john@duckfoot.co.uk

Re: Windows 10 FTP transfer connection failed

Thanks for the time you have spent considering and replying to this issue.
I agree with your comments above that I have misinterpreted the results of my testing.

Having tested further I have conclude that the problem is a Windows timing issue when Windows comes out of sleep mode to run a scheduled task; and not related to WinSCP. The issue surprises me as follows (and I am testing further.)

1) If I schedule the task to run a short time into the future (i.e. 30 minutes); restart the PC and immediately put it in sleep mode; the WinSCP task runs successfully.

2) If I schedule the task for a long time in the future (e.g. 8 hours for say an overnight backup) restart the PC and immediately put it in sleep mode, the WinSCP task fails with a "could not connect".

3) To investigate further I added a lines to the start of the batch file that is run by the scheduler to ping grahamdolan.UK. The task was scheduled for a long time in the future (e.g. 8 hours for say an overnight backup) restart the PC and immediately put it in sleep mode, the ping failed as did WinSCP with a "could not connect error". i.e. either grahamdolan.uk was down or there was no internet connectivity.

3) I then added two further pings to the start of the batch file that is run by the scheduler for localhost and 8.8.8.8. You will see the results below. The ping of grahamdolan.uk failed, but the other two pings worked and subsequently the WinSCP script ran successfully to connect to grahamdolan.uk. and ran successfully to its end.

So my conclusion is that there is something in my Windows or Network environment that changes at a time greater than 30 minutes after the PC is restarted and put into sleep mode, that is reactivated by pinging various hosts; which then allows WinSCP to "see" the target host.

Sorry to have taken your time to review a problem which is entirely mine.

Ping request could not find host grahamdolan.uk. Please check the name and try again.

Pinging AcerVeriton [::1] with 32 bytes of data:
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms

Ping statistics for ::1:
Packets: Sent = 10, Received = 10, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

Pinging 8.8.8.8 with 32 bytes of data:
Reply from 8.8.8.8: bytes=32 time=5ms TTL=119
Reply from 8.8.8.8: bytes=32 time=5ms TTL=119
Reply from 8.8.8.8: bytes=32 time=5ms TTL=119
Reply from 8.8.8.8: bytes=32 time=5ms TTL=119
Reply from 8.8.8.8: bytes=32 time=6ms TTL=119
Reply from 8.8.8.8: bytes=32 time=6ms TTL=119
Reply from 8.8.8.8: bytes=32 time=5ms TTL=119
Reply from 8.8.8.8: bytes=32 time=5ms TTL=119
Reply from 8.8.8.8: bytes=32 time=5ms TTL=119
Reply from 8.8.8.8: bytes=32 time=5ms TTL=119

Ping statistics for 8.8.8.8:
Packets: Sent = 10, Received = 10, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 5ms, Maximum = 6ms, Average = 5ms
Connecting to ftp.grahamdolan.uk ...
Connected
Starting the session...
Session started.
Active session: [1] grahamdolan.uk@ftp.grahamdolan.uk
Comparing...

martin

Re: Windows 10 FTP transfer connection failed

Windows ftp supports an active FTP mode only. In the mode the client have to listen for incoming connections, when transferring files and listing directories. That's what I believe did trigger the firewall popup, because it needs the incoming port to be opened in the firewall. On the contrary WinSCP (and basically all other FTP clients) uses passive mode by default. And you did not even connect with WinSCP. WinSCP never got to the point of transferring files or listing directories.
See also https://winscp.net/eng/docs/ftp_modes
Also confirming that popup creates firewall rule for ftp.exe only anyway. It should not have any impact on other applications.
So this should not be related at all. But hard to tell...
john@duckfoot.co.uk

Re: Windows 10 FTP transfer connection failed

In the above reply I forgot to mention an error popup which occurred when running Windows FTP from the command prompt (screen grab attached). Having ticked the box to allow public networks I successfully completed the interactive and scheduler tests described above.
I emphasise that WinSCP had never displayed any such error message and worked successfully interactively (GUI or command script).
Later I went back and re-tried the scheduler script described in the original post.
This now works as expected from a logged off sleep mode PC.

So two questions:
1 How could WinSCP run successfully interactively without issuing the message issued by Windows FTP/Firewall
2 As this seems to have been the issue that gave rise to my original post why was it not reported in some form in the log file.

But all now seems OK

Thanks for the pointer on troubleshooting.
john@duckfoot.co.uk

Re: Windows 10 FTP transfer connection failed

Yes – Windows FTP works. When the scheduled task ran I was logged off and the PC was woken from sleep mode to run it. The test file transferred successfully.

I modified the batch file that is described in the original post to contain only the lines:
CD \Users\john_\OneDrive\Scripts
ftp -s:FTPtestt.txt > \temp\ftptestlog.txt

The FTP script was:
open ftp.grahamdolan.uk

grahamdolan.uk
"password"
lcd c:\temp
put samplefile.txt
quit

Piped log file:
ftp> open ftp.grahamdolan.uk

Connected to ftp.grahamdolan.uk.
220 FTP server ready
200 UTF8 set to on
User (ftp.grahamdolan.uk:(none)):
331 Password required for grahamdolan.uk

230 Login successful. Username & password correct; FTP unlocked.
ftp> lcd c:\temp
Local directory now C:\temp.
ftp> put samplefile.txt
200 PORT command successful
150 Opening ASCII mode data connection for samplefile.txt
226 Transfer complete
ftp: 2 bytes sent in 0.01Seconds 0.13Kbytes/sec.
ftp> quit
221 Goodbye.
martin

Re: Windows 10 FTP transfer connection failed

Is any client (e.g. Windows ftp) able to connect in the situation WinSCP is not?
john@duckfoot.co.uk

Windows 10 FTP transfer connection failed

WinSCP Version 5.19.5 (Build 11933 2021-11-25)
(OS 10.0.19043 - Windows 10 Enterprise)

I have a scheduler task set up to run as my logon (ACERVERITON\john_), which is also an admin account.
It runs a batch file which executes a WinSCP script.
If I right click on the scheduled task and select "Run" the task runs and completes successfully.

If I am working on the PC when the scheduled task is triggered it runs successfully.

BUT if I am logged off or the PC wakes from sleep mode to run the task it fails.

Attached is a log showing first, the overnight failure and next what happens if I right click on the scheduled task and select run.

I have reviewed, as far as I can, the trouble shooting suggestions as to how to identify why this fails but with no success.

Ant suggestions as to how I can investigate further?

Batch file:
"C:\Program Files (x86)\WinSCP\WinSCP.exe" /log="\temp\ROG_WINSCP_full_backup.log" /ini=nul /script="\Users\john_\OneDrive\Scripts\ROG_WINSCP_backup.txt" > "\temp\ROG_WINSCP_session_backup.log"

WINSCP script:
open "ftp://***********.uk:**********@ftp.***********.uk/" -rawsettings ProxyPort=1
synchronize  local "T:\ROG -Backup\SQL_dump" "/SQL_dump" -transfer=binary -criteria=time
synchronize  local "T:\ROG -Backup\public_html" "/public_html" -transfer=binary -criteria=time
close
 
open "s3://AKIAS6Q******B7DQZ:****************@s3.amazonaws.com/"
synchronize remote "T:\ROG -Backup\SQL_dump" "/2020-royalobservatorygreenwich.org/sql_dump" -transfer=binary -criteria=time
synchronize remote "T:\ROG -Backup\public_html" "/2020-royalobservatorygreenwich.org/public_html" -transfer=binary -criteria=time
close
 
exit