my $envir = $ENV{ECR_ENV};
if ($envir eq 'dev') {
open FTP, "|ftp -n $ftpHost" or die "Problem with ftp to $ftpHost\n";
print FTP "user $ftpUser $ftpPass\n";
print FTP "lcd $archPath \n";
print FTP "put $outFileName \n";
print FTP "bye \n";
close FTP or die "Problem closing ftp connection to $ftpHost";
and the error I am getting is:
Local directory now /apps/XXX/XXX/a/teport
Please login with USER and PASS.
Passive mode refused. Turning off passive mode.
Please login with USER and PASS.
ftp: bind: Address already in use
---------- Post updated at 08:11 AM ---------- Previous update was at 04:40 AM ----------
I don't know, but what I do know is that to script any kind of auto-login of ftp seems to be a nightmare in any language. Try searching this forum for stuff like "ftp login", etc, or Google it.
Many people have tried to include a prompting for userid/password in their scripts or providing these as environment variables, and cannot make it work (apart from using ftp's in-built method of .netrc). It just appears to be a damned difficult thing.
The purpose of my post was purely to suggest that this error has less to do with your Perl scripting, and more to do with the ftp command itself.
@parthmittal2007 and further to earlier posters.
You have the ftp -n [parameter. This tells ftp that you are using a .netrc file and not logging in from the command line. See man ftp .
Have you tried this ftp manually without the complication of Perl? What is the full dialogue from such a manual session (not just the edited highlights)? This might give us a clue about the remote computer and whether it is actually a ftp server.
The last time I saw that bind error there was a duplicate IP address on the network. If there are Virtual Machines involved in this, please make it clear.
If you can, please post the Operating System and version of BOTH computers concerned. Your lack of basic information in new threads is pathetic after this number of posts.
One tip with ftp scripts is to test your local configuration first by connecting to localhost .