Jun 2, 2009, 9:56 AM
Post #1 of 3
I have the following code through which i am connecting to some ftp server:
Problem connecting to the ftp server
my $ftp = Net::FTP->new(HOST) or die "Couldn't connect :$@\n";
The problem is, if the ftp server is busy, the code dies giving the error message.
Is there a way where i can put it in a loop and try to connect until the connection is successful?
The simplest thing would be :
if cant connect then wait for say 10seconds and try to reconnect .This should continue for say 10 attempts.If it cant connect even after 10 attempts then the program should die.
Is there a way to do it in PERL ??