Ftp Error Bad File Descriptor
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 s +erver\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"; ...... ..... } } [download] ============================= 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 [download] ================================ 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. 20040514 Edit by castaway: Changed title from 'FTP script to get bin files from Unix server, after 1st file error "Bad file descriptor" rest files also error but all files can be manually pulled by mget at DOS-prompt.'Comment on Bad file descriptor' error with automated FTP script.Select or Download Code Replies are listed 'Best First'. Re: Bad file descriptor' error with automated FTP script. by mifflin (Curate) on May 14, 2004 at 07:09UTC I haven't used the dir() method in Net::FTP before but, by l
some reason when I use NET:FTP's get. I will get an error of "Bad file descriptor". What does this mean. Here is my code. use Net::FTP; $ftp http://www.perlmonks.org/bare/?node_id=353287 = Net::FTP ->new("$ip_address", Timeout => 200, debug => 1, ftp_passive => 1) or die "Can't connect: $!n"; $ftp->login($username, $password) or die "Still couldn't authenticate.\n"; $ftp->binary or die "could not set to binary. http://www.nntp.perl.org/group/perl.beginners/2003/01/msg39631.html $!\n"; $ftp->cwd("$pin_folder") or die "Couldn't change to dir $pin_folder: $!\n"; print "Step 4: Start FTP.\n"; $ftp->get("$file", "$rename") or $status = "not found: $!"; print "$status\n"; $ftp->quit(); Michael Kramer Thread Previous | Thread Next ftp: error Bad file descriptor by Michael Kramer Re: error Bad file descriptor by Rob Dixon ftp: error Bad file descriptor by michael kramer Re: error Bad file descriptor by Rob Dixon Re: ftp: error Bad file descriptor by Wiggins d'Anconia nntp.perl.org: Perl Programming lists via nntp and http. Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About
Join INTELLIGENT WORK FORUMSFOR COMPUTER PROFESSIONALS Log In Come Join Us! Are you aComputer / IT professional?Join Tek-Tips Forums! Talk With Other Members Be Notified http://www.tek-tips.com/viewthread.cfm?qid=1509249 Of ResponsesTo Your Posts Keyword Search One-Click Access To YourFavorite Forums http://www.ibm.com/support/docview.wss?uid=isg1PK61362 Automated SignaturesOn Your Posts Best Of All, It's Free! Join Us! *Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail. Posting Guidelines Promoting, selling, recruiting, coursework and thesis posting is forbidden.Tek-Tips Posting Policies Jobs Jobs from Indeed What: Where: jobs ftp error by Link To This Forum! Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.Just copy and paste the BBCode HTML Markdown MediaWiki reStructuredText code below into your site. Perl Forum at Tek-Tips HomeForumsProgrammersLanguagesPerl Forum Bad File Descriptor using NET::ftp thread219-1509249 Forum Search FAQs Links MVPs Bad File Descriptor using NET::ftp Bad File Descriptor using ftp error bad NET::ftp pcutler (TechnicalUser) (OP) 24 Oct 08 22:28 Hi,I'm playing around with NET::ftp, and I've run into a problem.I'm trying to write a script that will automatically FTP files to a remote server.Here's what I've tried:&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&use Net::FTP;my $host = "XXX.XX.XXX.XX";my $username = "UNAME";my $password = "PASSW";my $ftpdir = "/";my $file = "C:\\Today.txt";#-- connect to ftp servermy $ftp = Net::FTP->new($host) or die "Error connecting to $host: $!";#-- login$ftp->login($username,$password) or die "Login failed: $!";#-- set to binary$ftp->binary();#-- chdir to $ftpdir$ftp->cwd($ftpdir) or die "Can't go to $ftpdir: $!";#-- upload file$ftp->put($file) or die "Can't get $file: $!";#-- close ftp connection$ftp->quit or die "Error closing ftp connection: $!";&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&When I run the script, I get this error:"Can't get C:\Today.txt: Bad file descriptor at ftp_test.pl line 26." (that's the line after "#-- upload file"What am I doing wrong?When it's up and running, I want the script to look in a folder on the local machine, and upload all the files (40-60 per day) with a .pdf extension to the server. How would I use mput with NET::ftp to do this?Thanks for you
A fix is available Obtain the fix for this APAR. Subscribe You can track all active APARs for this component. APAR status Closed as program error. Error description While attempting PASV data connetions with the FTP Server, the server seems to get out of step after an initial failure is detected. The problem is that psListD() is called twice, even when it cleans up and returns a fatal error on the first call. So the initial failure logs should be used for diagnostic reasons and subsequent errors maybe misleading. Local fix Problem summary **************************************************************** * USERS AFFECTED: All users of the IBM Communications Server * * for z/OS Version 1 Release(s) 6, 7, 8 and 9 * * IP: FTP * **************************************************************** * PROBLEM DESCRIPTION: FTP server out of step with passive * * data connects after first failure * * detected. * **************************************************************** * RECOMMENDATION: * **************************************************************** FTP server out of step with passive data connects after first failure detected. The problem is that psListD() is called twice, even when it cleans up and returns a fatal error on the first call. FTP log shows the first failure 425 reply however calling pslistD() again results in the 550 reply being also sent to the FTP client: >>> PASV 425 Unable to open data connection. >>> PORT 213,144,1,9,4,5 550 No data sets found. >>> NLST 227 Entering Passive Mode (203,9,9,1,117,78) Command: dir >>> PASV 200 Port request OK. >>> LIST 227 Entering Passive Mode (203,9,9,1,117,195) Command: ls >>> PASV Connection to server interrupted or timed out. Waiting for reply Server not responding, closing connection. >>> NLST send error from sendCmd - EDC5113I Bad file descriptor. (errno2=0x1123011C) Connection with 203.9.9.1 terminated Command: quit +-------------------------------------------------------------+ + Please check our Communications Server for OS/390 homepages + + for common networking tips and fixes. The URL for these + + homepages can be found in Informational APAR II11334. + +---------------------------