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

choang66

FTP Connection Random Failures via Batch Script

I have an automated FTP script that is called via Windows Scheduled Tasks every 10 minutes. The script connects to an FTP site to look for a file. If file exists it will pull it to my local. I have noticed that the Winscp command fails with message "Connection Failed" sometimes. Other times it logs on FTP and disconnects just fine. Below is a sample script and error log. At 21:37:02.31 it runs fine. At 21:40:00.20 it fails to connect (no change to script).

::Script
option batch on
option confirm off
open ftp://ftpuser:ftppasswd=@FTPHost
option transfer ascii
lcd C:\ETL\ExcelModelLoads\EntityCashFlows\Asia\Inbox
cd Informatica\EntityCashFlows\Asia
get -delete *.dat
close
exit

::LOG
Process Batch Start - Date: Wed 06/26/2013 Time: 21:37:02.31
. 2013-06-26 21:37:02.846 --------------------------------------------------------------------------
. 2013-06-26 21:37:02.846 WinSCP Version 4.1.7 (Build 413) (OS 6.0.6002 Service Pack 2)
. 2013-06-26 21:37:02.846 Login time: Wednesday, June 26, 2013 9:37:02 PM
. 2013-06-26 21:37:02.846 --------------------------------------------------------------------------
. 2013-06-26 21:37:02.846 Session name: fptuser@FTPHost
. 2013-06-26 21:37:02.846 Host name: FTPHost (Port: 21)
. 2013-06-26 21:37:02.846 User name: fptuser (Password: Yes, Key file: No)
. 2013-06-26 21:37:02.846 Tunnel: No
. 2013-06-26 21:37:02.846 Transfer Protocol: FTP
. 2013-06-26 21:37:02.846 Ping type: C, Ping interval: 30 sec; Timeout: 15 sec
. 2013-06-26 21:37:02.846 Proxy: none
. 2013-06-26 21:37:02.846 FTP: Passive: No
. 2013-06-26 21:37:02.846 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2013-06-26 21:37:02.846 Cache directory changes: Yes, Permanent: Yes
. 2013-06-26 21:37:02.846 DST mode: 1
. 2013-06-26 21:37:02.846 --------------------------------------------------------------------------
. 2013-06-26 21:37:02.877 Connecting to FTPHost ...
. 2013-06-26 21:37:02.924 Connected with FTPHost. Waiting for welcome message...
< 2013-06-26 21:37:02.971 220 Microsoft FTP Service
> 2013-06-26 21:37:02.971 USER fptuser
< 2013-06-26 21:37:03.002 331 Password required for fptuser.
> 2013-06-26 21:37:03.002 PASS ********
< 2013-06-26 21:37:03.033 230 User fptuser logged in.
> 2013-06-26 21:37:03.033 SYST
< 2013-06-26 21:37:03.080 215 Windows_NT
> 2013-06-26 21:37:03.080 FEAT
< 2013-06-26 21:37:03.111 211-Extended features supported:
< 2013-06-26 21:37:03.346 SIZE
< 2013-06-26 21:37:03.346 MDTM
< 2013-06-26 21:37:03.346 211 END
. 2013-06-26 21:37:03.346 Connected
. 2013-06-26 21:37:03.346 --------------------------------------------------------------------------
. 2013-06-26 21:37:03.346 Using FTP protocol.
. 2013-06-26 21:37:03.346 Doing startup conversation with host.
> 2013-06-26 21:37:03.346 PWD
< 2013-06-26 21:37:03.393 257 "/" is current directory.
. 2013-06-26 21:37:03.393 Getting current directory name.
. 2013-06-26 21:37:03.393 Startup conversation with host finished.
. 2013-06-26 21:37:03.393 Changing directory to "Informatica\EntityCashFlows\Asia".
> 2013-06-26 21:37:03.393 CWD Informatica\EntityCashFlows\Asia
< 2013-06-26 21:37:03.424 250 CWD command successful.
. 2013-06-26 21:37:03.424 Getting current directory name.
> 2013-06-26 21:37:03.424 PWD
< 2013-06-26 21:37:03.471 257 "/Informatica/EntityCashFlows/Asia" is current directory.
. 2013-06-26 21:37:03.471 Retrieving directory listing...
> 2013-06-26 21:37:03.471 TYPE A
< 2013-06-26 21:37:03.502 200 Type set to A.
> 2013-06-26 21:37:03.518 PORT 10,2,40,114,231,31
< 2013-06-26 21:37:03.549 200 PORT command successful.
> 2013-06-26 21:37:03.549 LIST -a
< 2013-06-26 21:37:03.580 150 Opening ASCII mode data connection for /bin/ls.
< 2013-06-26 21:37:03.814 226 Transfer complete.
. 2013-06-26 21:37:03.814 Directory listing successful
. 2013-06-26 21:37:03.814 Disconnected from server
Process Batch Start - Date: Wed 06/26/2013 Time: 21:40:00.20
. 2013-06-26 21:40:01.459 --------------------------------------------------------------------------
. 2013-06-26 21:40:01.459 WinSCP Version 4.1.7 (Build 413) (OS 6.0.6002 Service Pack 2)
. 2013-06-26 21:40:01.459 Login time: Wednesday, June 26, 2013 9:40:01 PM
. 2013-06-26 21:40:01.459 --------------------------------------------------------------------------
. 2013-06-26 21:40:01.459 Session name: fptuser@FTPHost
. 2013-06-26 21:40:01.459 Host name: FTPHost (Port: 21)
. 2013-06-26 21:40:01.459 User name: fptuser (Password: Yes, Key file: No)
. 2013-06-26 21:40:01.459 Tunnel: No
. 2013-06-26 21:40:01.459 Transfer Protocol: FTP
. 2013-06-26 21:40:01.459 Ping type: C, Ping interval: 30 sec; Timeout: 15 sec
. 2013-06-26 21:40:01.459 Proxy: none
. 2013-06-26 21:40:01.459 FTP: Passive: No
. 2013-06-26 21:40:01.459 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2013-06-26 21:40:01.459 Cache directory changes: Yes, Permanent: Yes
. 2013-06-26 21:40:01.459 DST mode: 1
. 2013-06-26 21:40:01.459 --------------------------------------------------------------------------
. 2013-06-26 21:40:01.521 Connection failed.