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?
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.