Hi,
i'm trying to setup a ls command using Net::FTP.
First, i show you my code
my $ftp = Net::FTP->new( $row->{ftp_host}, Debug => 1)
or die "Cannot connect to " . $row->{ftp_host} . ": $@";
$ftp->login($row->{username}, $row->{password})
or die "Cannot login ", $ftp->message;
$ftp->cwd("/logs/web")
or die "Cannot change working directory ", $ftp->message;
$ftp->pasv;
my @dir = $ftp->ls; # <-- LINE 50
the trace looks as follows:
Net::FTP>>> Net::FTP(2.75)
+
Net::FTP>>> Exporter(5.58)
+
Net::FTP>>> Net::Cmd(2.26)
+
Net::FTP>>> IO::Socket::INET(1.27)
+
Net::FTP>>> IO::Socket(1.28)
+
Net::FTP>>> IO::Handle(1.24)
+
Net::FTP=GLOB(0x8521bbc)<<< 220 Microsoft FTP Service
+
Net::FTP=GLOB(0x8521bbc)>>> user xxxxxxxxxx
+
Net::FTP=GLOB(0x8521bbc)<<< 331 Password required for xxxxxxxxxx.
+
Net::FTP=GLOB(0x8521bbc)>>> PASS ....
+
Net::FTP=GLOB(0x8521bbc)<<< 230 User xxxxxxxxxx logged in.
+
Net::FTP=GLOB(0x8521bbc)>>> CWD /logs/web
+
Net::FTP=GLOB(0x8521bbc)<<< 250 CWD command successful.
+
Net::FTP=GLOB(0x8521bbc)>>> PASV
+
Net::FTP=GLOB(0x8521bbc)<<< 227 Entering Passive Mode (64,74,223,25,15
+,182).
Net::FTP=GLOB(0x8521bbc)>>> PORT 192,168,1,101,130,121
+
Net::FTP: Unexpected EOF on command channel at getenomlogs.pl line 50
I googled abou the 'Unexpected EOF on command channel' error, and it seems to be a aktiv <=> passiv FTP problem.
But i already did entering passiv mode (i also have to check this option in my ftp client to get a proper connection) but why is Net::FTP setting up a PORT command - isn't that the command for establishing an aktiv connection?
Does anybody know what to do?