SunQuest
           FTP Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationFTP Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old May 12th, 2004, 03:06 AM
ritunigam ritunigam is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 1 ritunigam User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Net::ftp

Sirs,

We have an Automated FTP script that pulls file from a server. This Script sometimes works without any error but sometimes is unable to pull even a single file. In case of such error, we manually (from DOS prompt) connect(FTP) to Unix based server and get files through "mget" command. This means that network and files are proper, but why is the script unable to pull with first error_msg as "Bad file descriptor" and all the other files give error_msg as "No such file or directory".

The relevent portions of the script are below:
===============================
####Connect to Server
open (FD1, ">>$logname") || print FD1 "Couldnt open - write $logname\n" ;
my $ftp=new Net::FTP("$server",Timeout=>"300000")|| print FD1 "Can not connect to ftp server\n";
$ftp->login("$username","$passwd")|| print FD1 "Can not login to ftp server\n";
.....
......

my @files=$ftp->dir or print FD1 "error in dir list--to var-- $dir \n";
....
.....
foreach(@files) {
#print "$_\n";
$_=substr($_,41);
s/ */ /g;
s/^ *//g;
chomp;

print FD1 "Getting $_\n";
$filename2=$_;
$filename=substr($filename2,0,12) ;
....
...
if( -f $first_check)
{
print FD1 "$filename exist, So no need to download \n";
}
else
{
.....
$ftp->binary();
$ftp->get($filename2) or $newerr=1;
#|| print "$filename2 can not be downloaded error $!\n";
if ($newerr)
{
print FD1 "$filename2 can not be downloaded error $!\n";
}
else {
print FD1 "Got file $filename2 \n";
......
.....
}
}
=============================

The relevent Log file output is below:

============================
TTFILE008498 exist, So no need to download
Getting TTFILE008499;1
TTFILE008499 exist, So no need to download
Getting TTFILE008500;1
TTFILE008500;1 can not be downloaded error Bad file descriptor
Getting TTFILE008501;1
TTFILE008501;1 can not be downloaded error No such file or directory
Getting TTFILE008502;1
TTFILE008502;1 can not be downloaded error No such file or directory
================================

Here the file that needs to be downloaded should not exists (first_check), and then download in binary mode.
We are unable to pull a single file somtimes, but n/w and file are fine.

Please suggest.

Ritu Nigam.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationFTP Help > Net::ftp


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway