Re: Net::FTP Wierdness; or Not.....





On Nov 9, 7:10 pm, Ben Morrow <benmor...@xxxxxxxxxxxxx> wrote:
Quoth huntingseason...@xxxxxxxxx:

Doing batches of FTP transfers.It is considered polite here to write in complete sentences.

Most of the time they work, sometimes
they dont. When they dont, the error messages seem to be the response
from the FTP server acknowledging my previous command, or empty.

Heres the code:
sub ftp_transfer() ^^
Do you know what this does? If not, don't put it there.

sure, type checking arguments, in this case, we accept none

{
my $ftp = Net::FTP->new($host) || _error("Can't connect to host $host:
$@");What is $host? I hope you're not passing values into subroutines through
globals: that's considered very bad style, for a number of good reasons.

indeed

_netcmd_error($ftp,"Can't login to $host as $username: "
$ftp->message)This line is not valid Perl. Are you missing a .?

unless $ftp->login($username,$password);This would be much clearer written as

$ftp->login($username, $password)
or _netcmd_error $ftp,
"Can't login to $host as $username: " . $ftp->message;

#ERROR COMES FROM HERE
_netcmd_error($ftp,"Can't transfer file $video: " . $ftp->message)
unless $ftp->put($video);
#################################################

$ftp->quit;

return 1;
}

The error I get is either: "Opening BINARY mode data connection for
xyz.mpg"
or empty.

Humm, I guess its probably better to call binary() 1st. But I cant
understand why the 2nd put() call fails with either nothing in
message(), or the response from the server when I called binary(). The
perldocs say that all calls return a true or false to indicate success
or failure, unless otherwise noted. So it is failing, but the message
is faulty. I really dont know.

From a quick look at the source of Net::FTP, I would say that if the put
fails sometime during the transfer (that is, if the STOR FTP command
succeeds but the actual transfer fails) then $ftp->message will not
contain anything useful. Try your transfer passing the Debug => 1 option
to Net::FTP to see if you can work out what's going wrong.

Ben

I will try debug

.



Relevant Pages

  • Re: FTP strangeness
    ... Listing an empty existing directory shouldn't return an error code. ... servers cannot issue a 550 reply to a LIST command. ... As demonstrated more than just VMS ftp servers do the latter - for situations ... In any case an FTP client should comply with the robustness principle of RFC ...
    (comp.os.vms)
  • Net::FTP Wierdness; or Not.....
    ... Doing batches of FTP transfers. ... When they dont, the error messages seem to be the response ... from the FTP server acknowledging my previous command, or empty. ... or the response from the server when I called binary. ...
    (comp.lang.perl.misc)
  • FTP: 421 Service not available....
    ... I am trying to ftp a file. ... 220 bigbird FTP server ready. ... 500 Command not understood. ... I dont know what to do ...
    (comp.os.linux.networking)
  • Re: Problem about Window Xp SP2 firewall and the buildin FTP command
    ... I copy your example ftp command file to a.txt saved in C:\dell folder. ... I cannot turn off Windows Firewall, since it is controlled by Domain ...
    (microsoft.public.windowsxp.general)
  • [NT] Multiple Vulnerabilities Found in PlatinumFTPserver
    ... A vulnerability in the product allows remote attackers to cause the server ... to traverse into directories that reside outside the bounding FTP root ... delete files and perform a DoS attack on the server. ... 200 PORT command successful ...
    (Securiteam)