$%##%$ Net::FTP timeout DOES NOT WORK for me! 
Author Message
 $%##%$ Net::FTP timeout DOES NOT WORK for me!

I have followed a recent suggestion about a libnet configuration
setting to get the FTP timeout to work in my FTP script, yet it keeps
locking up during a transfer as you can see at the end of this debug
log...it just sat there for 1/2 hour till I stopped it.  I think it
happens when there's a glitch in our DDS line, but the DDS line is
running as good as it's going to get, so I need a robust FTP transfer.

I included the pertinent snippet of code with the FTP commands in it
too.
I hope someone can help me out with this.  I've been pulling my hair
out over these lockups during transfers. (it works normally 95% of the
time, but I need as close as possible to 100%).

Thanks much,
Rob

***START DEBUG LOG***

Wed Oct 31 09:45:28 2001 Opening FTP connection.

Net::FTP: Net::FTP(2.56)
Net::FTP:   Exporter(5.562)
Net::FTP:   Net::Cmd(2.18)
Net::FTP:   IO::Socket::INET(1.25)
Net::FTP:     IO::Socket(1.26)
Net::FTP:       IO::Handle(1.21)

Net::FTP=GLOB(0x4002c0d0)<<< 220 www FTP server (Version wu-2.6.1-16)
ready.
Wed Oct 31 09:45:28 2001 Logging into FTP server.
Net::FTP=GLOB(0x4002c0d0)>>> user heehaw
Net::FTP=GLOB(0x4002c0d0)<<< 331 Password required for admin.
Net::FTP=GLOB(0x4002c0d0)>>> PASS ....
Net::FTP=GLOB(0x4002c0d0)<<< 230 User heehaw logged in.
Sending 27 files.
Net::FTP=GLOB(0x4002c0d0)>>> CWD /home/webpage/billy
Net::FTP=GLOB(0x4002c0d0)<<< 250 CWD command successful.
Wed Oct 31 09:45:29 2001Sending chic_sop_1.html to webserver at
/home/webpage/billy.
Net::FTP=GLOB(0x4002c0d0)>>> PORT 10,10,220,6,18,148
Net::FTP=GLOB(0x4002c0d0)<<< 200 PORT command successful.
Net::FTP=GLOB(0x4002c0d0)>>> STOR chic_sop_1.html
Net::FTP=GLOB(0x4002c0d0)<<< 150 Opening ASCII mode data connection
for chic_sop_1.html.
Net::FTP=GLOB(0x4002c0d0)<<< 226 Transfer complete.
Net::FTP=GLOB(0x4002c0d0)>>> CWD /home/webpage/billy
Net::FTP=GLOB(0x4002c0d0)<<< 250 CWD command successful.
Wed Oct 31 09:45:30 2001Sending index.html to webserver at
/home/webpage/billy.
Net::FTP=GLOB(0x4002c0d0)>>> PORT 10,10,220,6,18,149
Net::FTP=GLOB(0x4002c0d0)<<< 200 PORT command successful.
Net::FTP=GLOB(0x4002c0d0)>>> STOR index.html
Net::FTP=GLOB(0x4002c0d0)<<< 150 Opening ASCII mode data connection
for index.html.
***END DEBUG LOG***

***START CODE SNIPPET***
.
. [includes and other logic snipped]
.
print localtime() . " Opening FTP connection.\n";
my $ftp = Net::FTP->new("$ARGV[0]", Debug => 1, Timeout=>30) || die
"Couldn't get FTP handle.\n";
print localtime() . " Logging into FTP server.\n";
$ftp -> login("$ARGV[1]","$ARGV[2]") || die "Couldn't authenticate on
remote server.\n";
my $status;
print "Sending $#files files.\n";
for ($i = 0; $i <= $#files; $i++)
{

        my ($path,$filename);

        #SEPARATE THE PATH AND FILENAME FOR FTP.
        if ($#filepath != 0)
        {
                my $i = 0;
                for ($i; $i <= $#filepath - 1; $i++)
                {
                        $path = $path . $filepath[$i] . "/";
                }
        }
        $filename = $filepath[$#filepath];
        if ($#filepath != 0)
        {
                chdir "$path";
        }

        $status = $ftp -> cwd("/home/webpage/$users[$i]") ;
        if ($status)
        {
                print localtime() . "Sending $filename to webserver at
/home/webpage/$users[$i].\n";

                my $num_retries = 0;
                $status = $ftp -> put("$filename");
                if (!$status && $num_retries <= $retries)
                {
                        sleep $delay_between_retries;
                        $status = $ftp -> put("$filename");
                        $num_retries++;
                }
        }
        else
        {
                print "Hey buddy, target path
(/home/webpage/$users[$i]) does not exist!\n";
        }

        if (!$status) {print "Couldn't transfer file: $filename
successfully.\n";}

Quote:
}

$ftp -> quit;


Mon, 19 Apr 2004 00:31:19 GMT  
 $%##%$ Net::FTP timeout DOES NOT WORK for me!
Hi Rob,

I already posted you a reply-reply before I saw THIS entry, see this

I also have no hair left.
Would like to have your configuration, os, versions etc.

Would REALLY appreciate it very much to hear from you.

Thomas

Quote:

> I have followed a recent suggestion about a libnet configuration
> setting to get the FTP timeout to work in my FTP script, yet it keeps
> locking up during a transfer as you can see at the end of this debug
> log...it just sat there for 1/2 hour till I stopped it.  I think it
> happens when there's a glitch in our DDS line, but the DDS line is
> running as good as it's going to get, so I need a robust FTP transfer.

> I included the pertinent snippet of code with the FTP commands in it
> too.
> I hope someone can help me out with this.  I've been pulling my hair
> out over these lockups during transfers. (it works normally 95% of the
> time, but I need as close as possible to 100%).

> Thanks much,
> Rob

> ***START DEBUG LOG***

> Wed Oct 31 09:45:28 2001 Opening FTP connection.

> Net::FTP: Net::FTP(2.56)
> Net::FTP:   Exporter(5.562)
> Net::FTP:   Net::Cmd(2.18)
> Net::FTP:   IO::Socket::INET(1.25)
> Net::FTP:     IO::Socket(1.26)
> Net::FTP:       IO::Handle(1.21)

> Net::FTP=GLOB(0x4002c0d0)<<< 220 www FTP server (Version wu-2.6.1-16)
> ready.
> Wed Oct 31 09:45:28 2001 Logging into FTP server.
> Net::FTP=GLOB(0x4002c0d0)>>> user heehaw
> Net::FTP=GLOB(0x4002c0d0)<<< 331 Password required for admin.
> Net::FTP=GLOB(0x4002c0d0)>>> PASS ....
> Net::FTP=GLOB(0x4002c0d0)<<< 230 User heehaw logged in.
> Sending 27 files.
> Net::FTP=GLOB(0x4002c0d0)>>> CWD /home/webpage/billy
> Net::FTP=GLOB(0x4002c0d0)<<< 250 CWD command successful.
> Wed Oct 31 09:45:29 2001Sending chic_sop_1.html to webserver at
> /home/webpage/billy.
> Net::FTP=GLOB(0x4002c0d0)>>> PORT 10,10,220,6,18,148
> Net::FTP=GLOB(0x4002c0d0)<<< 200 PORT command successful.
> Net::FTP=GLOB(0x4002c0d0)>>> STOR chic_sop_1.html
> Net::FTP=GLOB(0x4002c0d0)<<< 150 Opening ASCII mode data connection
> for chic_sop_1.html.
> Net::FTP=GLOB(0x4002c0d0)<<< 226 Transfer complete.
> Net::FTP=GLOB(0x4002c0d0)>>> CWD /home/webpage/billy
> Net::FTP=GLOB(0x4002c0d0)<<< 250 CWD command successful.
> Wed Oct 31 09:45:30 2001Sending index.html to webserver at
> /home/webpage/billy.
> Net::FTP=GLOB(0x4002c0d0)>>> PORT 10,10,220,6,18,149
> Net::FTP=GLOB(0x4002c0d0)<<< 200 PORT command successful.
> Net::FTP=GLOB(0x4002c0d0)>>> STOR index.html
> Net::FTP=GLOB(0x4002c0d0)<<< 150 Opening ASCII mode data connection
> for index.html.
> ***END DEBUG LOG***

> ***START CODE SNIPPET***
> .
> . [includes and other logic snipped]
> .
> print localtime() . " Opening FTP connection.\n";
> my $ftp = Net::FTP->new("$ARGV[0]", Debug => 1, Timeout=>30) || die
> "Couldn't get FTP handle.\n";
> print localtime() . " Logging into FTP server.\n";
> $ftp -> login("$ARGV[1]","$ARGV[2]") || die "Couldn't authenticate on
> remote server.\n";
> my $status;
> print "Sending $#files files.\n";
> for ($i = 0; $i <= $#files; $i++)
> {

>         my ($path,$filename);

>         #SEPARATE THE PATH AND FILENAME FOR FTP.
>         if ($#filepath != 0)
>         {
>                 my $i = 0;
>                 for ($i; $i <= $#filepath - 1; $i++)
>                 {
>                         $path = $path . $filepath[$i] . "/";
>                 }
>         }
>         $filename = $filepath[$#filepath];
>         if ($#filepath != 0)
>         {
>                 chdir "$path";
>         }

>         $status = $ftp -> cwd("/home/webpage/$users[$i]") ;
>         if ($status)
>         {
>                 print localtime() . "Sending $filename to webserver at
> /home/webpage/$users[$i].\n";

>                 my $num_retries = 0;
>                 $status = $ftp -> put("$filename");
>                 if (!$status && $num_retries <= $retries)
>                 {
>                         sleep $delay_between_retries;
>                         $status = $ftp -> put("$filename");
>                         $num_retries++;
>                 }
>         }
>         else
>         {
>                 print "Hey buddy, target path
> (/home/webpage/$users[$i]) does not exist!\n";
>         }

>         if (!$status) {print "Couldn't transfer file: $filename
> successfully.\n";}
> }

> $ftp -> quit;



Mon, 19 Apr 2004 08:58:41 GMT  
 $%##%$ Net::FTP timeout DOES NOT WORK for me!

Quote:
>I have followed a recent suggestion about a libnet configuration
>setting to get the FTP timeout to work in my FTP script, yet it keeps
>locking up during a transfer as you can see at the end of this debug
>log...it just sat there for 1/2 hour till I stopped it.  I think it
>happens when there's a glitch in our DDS line, but the DDS line is
>running as good as it's going to get, so I need a robust FTP transfer.

>I included the pertinent snippet of code with the FTP commands in it
>too.
>I hope someone can help me out with this.  I've been pulling my hair
>out over these lockups during transfers. (it works normally 95% of the
>time, but I need as close as possible to 100%).

[snip]
>Net::FTP=GLOB(0x4002c0d0)>>> PORT 10,10,220,6,18,149
>Net::FTP=GLOB(0x4002c0d0)<<< 200 PORT command successful.
>Net::FTP=GLOB(0x4002c0d0)>>> STOR index.html
>Net::FTP=GLOB(0x4002c0d0)<<< 150 Opening ASCII mode data connection
>for index.html.
>***END DEBUG LOG***

Hi

I've been having the same problem with Net::FTP stopping at exactly
the same point intermittently with one particular FTP server out of
about a dozen that I mirror on a regular basis.  Just recently I think
I've found the problem (at least in my earlier Perl/libnet
installation running on Win98).

After liberally sprinkling print statements throughout Net::FTP,
Net::Cmd & IO::Socket it seems that the problem always occurs with an
'accept' statement that hangs in the accept routine within IO:Socket.

To fix it - add a  Timeout => 30  (or whatever value you want) to the
IO::Socket::INET->new  call in the  port  subroutine  in Net::FTP.

The fix appears to have been added to the latest version of libnet
available on CPAN.

I've tested it out on the troublesome site quite a bit and caught a
few timeouts at this point in the code with no more unexplained hangs.

Let me know if this works (or doesnt) for you.

Regards

--
Richard Tibbitt
Looe, Cornwall, UK



Tue, 27 Apr 2004 00:03:20 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. net::ftp / net::config / timeout does not work

2. Q: Net::FTP, Timeout doesn't seem to work

3. Q: Net::FTP, Timeout doesn't seem to work

4. Q: Net::FTP, Timeout doesn't seem to work

5. Net::FTP - Get and Put not working.

6. Net::FTP ftp->ls() stopped working

7. Handling Net::FTP (Socket) timeouts

8. Net::FTP and timeouts in script

9. Net::FTP to SunOS Server: Timeout Problems

10. net::ftp timeout

11. Net::FTP and timeout ! HELP

12. Net::FTP timeout when host is down

 

 
Powered by phpBB® Forum Software