Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help wth Net::FTP in script sometimes fails but wsftp always works

Status
Not open for further replies.

csgonan

MIS
May 2, 2007
118
US
Hi,

I have a script that transfers files from a Solaris server to target unix servers. The script uses Net::FTP->put to write the files, which can be any number of files, not always the same. This script works flawlessly to many servers.

Sometimes the 'puts' fail, not always on the same file. What is odd is I can transfer that file, and many others with ws-ftp from my PC. Any idea why that would be? First I tried to set the buffer size in the ftp->new to the 4096 like wsftp, from the default 10240, but that didn't work.

I see in the doc about Net::FTP, there is a dataconn class. Can I use those commands without specifying any other class in the perl program? There is a "write ( BUFFER, SIZE [, TIMEOUT ] )" statement. I cannot find any more information about that, like what is the default BUFFER. Can I use it instead of 'put'?

thanks
 
To add to the above thread, this problem only occurs on one instance of the script to one particular servers.
 
I suspect that wsftp also fails sometimes, but it has code to retry whenever there is a problem with the ftp software the contacted server.

I suggest you simply attempt to detect if there is a problem with the file transfer, and if so, retry and/or reconnect to the server. The functions mdtm ( FILE ) and size ( FILE ) should be useful for such sanity checks. Just be sure to put a limit on the number of retries before it totally fails and maybe emails you of the problem.

- Miller
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top