Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Problem with Net::FTP

by cool (Scribe)
on Jul 10, 2007 at 13:16 UTC ( #625812=note: print w/replies, xml ) Need Help??


in reply to Re: Problem with Net::FTP
in thread Problem with Net::FTP

Thankyou for your suggestion rpanman,
[sjoh@nucleix method]$ perl ftp1.pl 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(0x9da13a0)<<< 220 (vsFTPd 2.0.5) Net::FTP=GLOB(0x9da13a0)>>> user anonymous Net::FTP=GLOB(0x9da13a0)<<< 331 Please specify the password. Net::FTP=GLOB(0x9da13a0)>>> PASS .... Net::FTP=GLOB(0x9da13a0)<<< 230 Login successful. Net::FTP=GLOB(0x9da13a0)>>> CWD /pub/CPAN Net::FTP=GLOB(0x9da13a0)<<< 250-The Comprehensive Perl Archive Network + (http://www.cpan.org/) Net::FTP=GLOB(0x9da13a0)<<< 250-master site has been from the very beg +inning (1995) hosted at FUNET, Net::FTP=GLOB(0x9da13a0)<<< 250-the Finnish University NETwork. Net::FTP=GLOB(0x9da13a0)<<< 250- Net::FTP=GLOB(0x9da13a0)<<< 250- Net::FTP=GLOB(0x9da13a0)<<< 250 Directory successfully changed. Net::FTP=GLOB(0x9da13a0)>>> PASV Net::FTP=GLOB(0x9da13a0)<<< 227 Entering Passive Mode (193,201,200,224 +,185,150) Net::FTP=GLOB(0x9da13a0)>>> RETR README.html Net::FTP=GLOB(0x9da13a0): Timeout at ftp1.pl
but now if I add as tirwhan suggested,
my $ftp=Net::FTP->new("ftp.cpan.org", Firewall => "XXXX", Debug => 1) ine 8
Where XXXX- proxy of my institute
I am getting message
Couldnt connect:Net::FTP: connect: Connection refused

Replies are listed 'Best First'.
Re^3: Problem with Net::FTP
by dsheroh (Prior) on Jul 10, 2007 at 13:48 UTC
    Net::FTP=GLOB(0x9da13a0)<<< 220 (vsFTPd 2.0.5)
    Net::FTP=GLOB(0x9da13a0)>>> user anonymous
    Net::FTP=GLOB(0x9da13a0)<<< 331 Please specify the password.

    That certainly looks like a successful FTP connection to me and

    Couldnt connect:Net::FTP: connect: Connection refused

    obviously isn't, so skip the Firewall setting. It seems to break your setup rather than fixing it.

    When you run the script without setting Firewall, is the file README.html created or not? If it is, then everything is working right (more or less) and the main problem is that it didn't print anything to tell you so. If not, then the problem is that timeout and you'll probably want to try FTPing the file using a traditional interactive FTP client to make sure that works before beating your head against this wall too much more.

      Dear dsheroh, As you suggested, I run it without firewall settings and got these messages.
      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(0x8402408)<<< 220-&#65533;w&#65533;&#65533;&#65533;&#655 +33;&#65533;{&#65533;q&#65533;u&#65533;j&#65533;&#65533;&#65533;&#622; +&#1510;&#65533;&#65533;A&#65533;&#65533; Net::FTP=GLOB(0x8402408)<<< 220- Net::FTP=GLOB(0x8402408)<<< 220-&#65533;&#65533;&#65533;&#65533;&#6553 +3;&#65533;&#65533;&#1125;H&#65533;U&#65533;n&#65533;&#65533;&#65533;i +&#65533;&#1124;U&#65533; Net::FTP=GLOB(0x8402408)<<< 220-************************************** +***************************************** Net::FTP=GLOB(0x8402408)<<< 220-/pub/BeOS/ BeOS &#65533;@&#65533 +;~&#65533;t&#65533; Net::FTP=GLOB(0x8402408)<<< 220-/pub/CPAN/ Perl &#65533;{&#65533 +;&#65533;&#65533;y&#65533;&#65533; (Comprehensive Perl Archive Networ +k) Net::FTP=GLOB(0x8402408)<<< 220-/pub/CPatch/ &#65533;&#65533;&#655 +33;&#65533;&#65533;&#435;n&#65533;&#65533; (&#65533;&#65533;&#65533;& +#65533;&#65533;j&#65533;q&#65533;&#65533; Windows &#65533;@&#65533;&# +627;n&#65533;&#65533;&#65533;P&#65533;&#65533;&#65533;&#65533;&#65533 +;&#437;{&#65533;&#65533;) Net::FTP=GLOB(0x8402408)<<< 220-/pub/Documents/ &#65533;U&#65533;&#65 +533;&#65533;&#65533;&#65533;&#944950;&#65533; Net::FTP=GLOB(0x8402408)<<< 220-/pub/FreeBSD/ FreeBSD &#65533;@&#65 +533;~&#65533;t&#65533; Net::FTP=GLOB(0x8402408)<<< 220-/pub/Game/ &#65533;K&#65533;O&#6 +5533;C&#65533;&#65533;&#65533;n&#65533; Net::FTP=GLOB(0x8402408)<<< 220-/pub/Hardware/ &#65533;w&#65533;&#65 +533;&#65533;X&#65533;&#693;{&#65533;&#65533; Net::FTP=GLOB(0x8402408)<<< 220-/pub/Linux/ Linux &#65533;@&#6553 +3;~&#65533;t&#65533; Net::FTP=GLOB(0x8402408)<<< 220-/pub/MsDownload/ &#65533;L&#65533;n&#6 +5533;&#65533;&#65533;&#65533;&#65533;n&#65533;&#65533;&#65533;&#65533 +;&#65533;s (&#65533;&#1190;p Service Pack &#65533;&#65533;) Net::FTP=GLOB(0x8402408)<<< 220-/pub/RFC/ Request for Comments +(RFC &#65533;&#65533;&#65533; Net::FTP=GLOB(0x8402408)<<< 220-/pub/Solaris/ Solaris &#65533;@&#65 +533;~&#65533;t&#65533; Net::FTP=GLOB(0x8402408)<<< 220-/pub/Yesterday/ &#65533;Q&#65533;&#65 +533;&#65533;p&#65533;v&#65533;&#65533;&#65533;&#65533; mirror (&#6553 +3;&#65533;&#65533;&#65533;&#65533;j&#65533;q Windows &#65533;&#65533; +&#65533;&#65533;&#65533;n&#65533; Net::FTP=GLOB(0x8402408)<<< 220-************************************** +***************************************** Net::FTP=GLOB(0x8402408)<<< 220- Net::FTP=GLOB(0x8402408)<<< 220-&#65533;t&#65533;~&#65533;A&#65533;w&# +65533;&#65533;&#65533;&#997;&#938;&#806;h&#65533;h&#65533;Q&#65533;&# +65533; HTTP &#65533;&#65533;&#65533;&#35233;&#65533;n&#65533;J&#65533 +;A&#65533;@&#65533;&#1254;&#65533;&#65533;&#65533;&#65533;&#938;&#655 +33; Net::FTP=GLOB(0x8402408)<<< 220-&#65533;&#511;&#65533;&#65533;&#303;&# +65533;&#65533;A&#65533;&#65533;&#65533;&#65533;&#65533;\&#65533;&#655 +33;&#65533;]&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;& +#65533;&#65533;A&#65533;z&#65533;&#1637;i&#65533;H&#65533;Q&#65533;&# +65533;&#65533;&#622;&#1527;j&#65533;M&#65533;&#65533;&#65533;&#65533; Net::FTP=GLOB(0x8402408)<<< 220-&#65533;&#1459;t&#65533;&#65533;&#6553 +3;&#65533;&#65533;z&#65533;&#1211;&#1896;D&#65533;&#65533;&#65533;&#6 +22;&#1505;A&#65533;&#65533;&#65533;}&#65533;p&#65533;U&#65533;G Net::FTP=GLOB(0x8402408)<<< 220- Net::FTP=GLOB(0x8402408)<<< 220-http://ftp.isu.edu.tw Net::FTP=GLOB(0x8402408)<<< 220 Net::FTP=GLOB(0x8402408)>>> user anonymous Net::FTP=GLOB(0x8402408)<<< 230 Login successful. Net::FTP=GLOB(0x8402408)>>> CWD /pub/CPAN Net::FTP=GLOB(0x8402408)<<< 250-The Comprehensive Perl Archive Network + (http://www.cpan.org/) Net::FTP=GLOB(0x8402408)<<< 250-master site has been from the very beg +inning (1995) hosted at FUNET, Net::FTP=GLOB(0x8402408)<<< 250-the Finnish University NETwork. Net::FTP=GLOB(0x8402408)<<< 250- Net::FTP=GLOB(0x8402408)<<< 250- Net::FTP=GLOB(0x8402408)<<< 250 Directory successfully changed. Net::FTP=GLOB(0x8402408)>>> PASV Net::FTP=GLOB(0x8402408)<<< 227 Entering Passive Mode (140,127,177,17, +236,200) Net::FTP=GLOB(0x8402408)>>> RETR README.html Net::FTP=GLOB(0x8402408): Timeout at ftp1.pl line 9

      NO file has been created in current working directory so far
        OK, no file. So have you tried FTPing that file using any software other than this Perl script? e.g., since you're on Linux:

        wget ftp://ftp.cpan.org/pub/CPAN/README.html

        should be available and do basically the same thing as your script is trying to do. If wget isn't there, you can also try curl or ftp.

        (Incidentally, I just tried this a couple times with wget, and had one mirror time out. Timing out... when using a known-good tool... which is the same way your script is failing... Interesting, no?)

Re^3: Problem with Net::FTP
by rpanman (Scribe) on Jul 10, 2007 at 15:16 UTC
    From the debug output it looks like the script is connecting using passive mode - you can see this from the line
    Net::FTP=GLOB(0x9da13a0)>>> PASV
    ... it then times out for some reason - presumably because it is not receiving any data from ftp.cpan.org (maybe this is being firewalled out.
    (more info on passive/active FTP here: http://slacksite.com/other/ftp.html)

    ... which is strange since when I run the same script it does not enter passive mode...
    Net::FTP>>> Net::FTP(2.77) Net::FTP>>> Exporter(5.58) Net::FTP>>> Net::Cmd(2.28) Net::FTP>>> IO::Socket::INET(1.31) Net::FTP>>> IO::Socket(1.30) Net::FTP>>> IO::Handle(1.27) Net::FTP=GLOB(0x22d19c)<<< 220 Welcome to the ftp.linux.hr FTP service +. Net::FTP=GLOB(0x22d19c)>>> USER anonymous Net::FTP=GLOB(0x22d19c)<<< 331 Please specify the password. Net::FTP=GLOB(0x22d19c)>>> PASS .... Net::FTP=GLOB(0x22d19c)<<< 230- Net::FTP=GLOB(0x22d19c)<<< 230-Ovo je ftp.linux.hr, FTP posluzitelj Hr +vatske Udruge Linux Korisnika. Net::FTP=GLOB(0x22d19c)<<< 230- Net::FTP=GLOB(0x22d19c)<<< 230-Pogledajte README datoteku za opis sadr +zaja na nasem posluzitelju. Net::FTP=GLOB(0x22d19c)<<< 230- Net::FTP=GLOB(0x22d19c)<<< 230-CD ISO imagei su na iso.linux.hr! Net::FTP=GLOB(0x22d19c)<<< 230- Net::FTP=GLOB(0x22d19c)<<< 230- -- ftpadmin@linux.hr Net::FTP=GLOB(0x22d19c)<<< 230 Login successful. Net::FTP=GLOB(0x22d19c)>>> CWD /pub/CPAN Net::FTP=GLOB(0x22d19c)<<< 250-The Comprehensive Perl Archive Network +(http://www.cpan.org/) Net::FTP=GLOB(0x22d19c)<<< 250-master site has been from the very begi +nning (1995) hosted at FUNET, Net::FTP=GLOB(0x22d19c)<<< 250-the Finnish University NETwork. Net::FTP=GLOB(0x22d19c)<<< 250- Net::FTP=GLOB(0x22d19c)<<< 250- Net::FTP=GLOB(0x22d19c)<<< 250 Directory successfully changed. Net::FTP=GLOB(0x22d19c)>>> PORT 164,48,254,74,158,171 Net::FTP=GLOB(0x22d19c)<<< 200 PORT command successful. Consider using + PASV. Net::FTP=GLOB(0x22d19c)>>> RETR README.html Net::FTP=GLOB(0x22d19c)<<< 150 Opening BINARY mode data connection for + README.html (5804 bytes). Net::FTP=GLOB(0x22d19c)<<< 226 File send OK.
    Maybe you can try active mode and see if that works. You can do this using the following line:
    my $ftp=Net::FTP->new("ftp.cpan.org", Debug => 1, Passive => 0)
    Hope that helps.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://625812]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2020-02-29 00:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What numbers are you going to focus on primarily in 2020?










    Results (127 votes). Check out past polls.

    Notices?