Hello all,
I need to use alarm to time out a connection to an SFTP server if the
connection hangs (I was able to reproduce such a hang using the Secure
Shell Server for Windows, so I thought it would be nice if my script
assumed this was a possibility).
I think I am not understanding the
-Original Message-
From: Ian Zapczynski [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 20, 2002 7:01 PM
To: [EMAIL PROTECTED]
Subject: how to use alarm() to properly time out a connection?
Hello all,
I need to use alarm to time out a connection to an SFTP server if the
Jose,
Yes, you are correct. I did not know about placing the alarm prior to
the hanging condition (gee, I guess that makes sense) or clearing the
alarm afterwards. Thank you!
-Ian
NYIMI Jose (BMB) wrote:
-Original Message-
From: Ian Zapczynski [mailto:[EMAIL PROTECTED]]
Sent:
eval {
$sftp = Net::SFTP-new($FTPHOST, user=$FTPUSER,
password=$FTPPASS);
local $SIG{ALRM} = sub { die alarm\n };
alarm 60;
};
if ($@) {
sendSNMP unless $@ eq alarm\n;
}
When I run the test code with the endless while loop,
Date sent: Fri, 20 Dec 2002 13:00:59 -0500
From: Ian Zapczynski [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject:how to use alarm() to properly time out a connection?
I need to use alarm to time out a connection to an SFTP server