Re: How to catch error (or exit) when Receive hang (General questions)
Hi Damba,
It doesn't work! I have tried the try/catch Perl equivalent (eval) and also tried with Perl Error module (try {} catch Error with {};) both got stuck at  Receive . Here is code block using eval: When the count reaches 4, it got stuck, so I believe it's because of  Receive , not the for loop.
Thanks,
==== code ====
eval {
   for (my $i = 1; $i<=20; $i++) {
      print  Count: $i
 ;
      $buffer .= $ssh->Receive();
      print  $buffer
 ;
      }
};
if ($@) {
   print  Error!!!
 ;
   sleep 5;
   $ssh->Disconnect();
   return $buffer;
}
=================


![Open whole thread [*]](themes/default/images/complete_thread.png)









