in reply to Re: Net::SSH2 odd polling behavior
in thread Net::SSH2 odd polling behavior

I tried same thing to implement, a channel timeout, to clean shutdown the ssh2 connection, in a case of a backend failure.

Probable the timeout should be implemented on the ssh2 socket level rather than the channel itself. I would be curious to see how the author of the thread, iamb, implemented the timeout setting snd and rcv timeouts on the ssh socket.

At the moment I am using setsockopt($sock, SOL_SOCKET, SO_KEEPALIVE, 1)

if($ssh2->connect($dest, $port)) { my $sock = $ssh2->sock; setsockopt($sock, SOL_SOCKET, SO_KEEPALIVE, 1) or die "fatal: cant set socket in SO_KEEPALIVE mode $!"; ... }