[Ssh-sftp-perl-users] Detecting connection closed by server.
Brought to you by:
dbrobins
|
From: Enrique de A. S. <enr...@pc...> - 2005-11-14 14:12:10
|
Hi,
I'm doing a little program which sends command to anothe machine
periodically. The code of this program is basically the next one:
my $ssh = Net::SSH::Perl->new($host, protocol => 2, compression => 1,
debug => 1);
$ssh->login($user, $pass);
my $i;
for ($i=0; $i<10; $i++) {
print "Iteration $i\n";
my ($out, $err, $exit) = $ssh->cmd("ls");
print ($out, $err, $exit, "\n");
sleep 60;
}
I'm using SSH-2 to avoid authenticate myself each time I send a command
(it's very important for me because time reasons).
I have next problems, sometimes it's possible that ssh server close SSH
connection. Then, requests sent by the client has not response, but it
is unable to detect it.
Has anybody any idea about how to detect that server has closed the
connection?
Thanks in advance,
Enrique.
|