Gossamer Forum
Home : General : Perl Programming :

NET::ftp hangs after remote log on

Quote Reply
NET::ftp hangs after remote log on
Hi

I installed Libnet-1.13 and got a test program running NET::ftp.

It seems to log on to the remote server and change diretory OK but refuses to get files or list the directory.

Is there something I should do on the remote server? Is there something I should do in the Libnet-1.13/Configure script?

I just ran the program from the Telnet command line.

Here's the code I was using:

#!/usr/bin/perl

use Net::FTP;

$switch = '-g';
$user = 'myuserid';
$password = 'mypassword';
$server = 'www.domain.co.uk';
$filename = 'filename.txt';
$path = '/usr/local/www/myremotepath';
$localpath = '/pub/home/htdocs/mylocalpath';


$ftp = Net::FTP->new($server); # contact server
$ftp->login($user, $password);
print "Logged on\n";
$ftp->cwd($path);
print "Changed directory to $path\n";
print "About to list the directory\n";
$ftp->ls || die "Failed to list\n";
print "About to get file $path $filename and put it in $localpath\n";
$ftp->get($filename, $filename, $localpath) || die "Failed to get $path $filename\n";

print "About to quit\n";

$ftp->quit();





Any help would be great.



Thanks
Quote Reply
Re: [Blurry] NET::ftp hangs after remote log on In reply to
Hello Blurry, I have not looked too hard at your code.

But I have a simple script that will get a file from ftp.microsoft.com [ see attached grab.pl ]

Try this out and read the Net::FTP info you can easily find with google.com

You will have to think of permissions when you ask to change a dir on a remote server.

Grab.pl will work. You should use a valid email address for the password.

Thanks

cornball

perl grab.pl


Attempting to connect to ftp.microsoft.com ... waiting on host connection...
Connected to ftp.microsoft.com
We are in !!!
Changing to Ascii mode for transfer
In Ascii mode for file transfer
The file README.TXT has safely landed as bob.txt !
Thankyou and have a nice day .


Also your ls has no where to hold the return information versus :

@ls = $ftp->ls;

Does that make sence to you ? Why do an ls and not use the info ?

Last edited by:

cornball: Apr 13, 2003, 11:02 PM
Quote Reply
Re: [Blurry] NET::ftp hangs after remote log on In reply to
Turn on Net::FTP's debugging option Tongue
Quote Reply
Re: [Paul] NET::ftp hangs after remote log on In reply to
Thanks Paul

I used debug and got the following:


Net::FTP=GLOB(0x8057fa8)>>> PASV
Net::FTP=GLOB(0x8057fa8)<<< 227 Entering Passive Mode (string of comma-separated numbers)
Net::FTP=GLOB(0x8057fa8)>>> REST /pub/home/my/local/directory

Net::FTP=GLOB(0x8057fa8)<<< 500 'REST /pub/home/my/local/directory': command not understood.




For one thing I had 'Passive' turned off in the Configure settings and for another I don't know why the REST command is not understood. Is there something I should do on my server to enable REST (Restart interrupted transfers)?

Thanks

Blurry