in reply to Re: Forking server for ssh tunnels
in thread Forking server for ssh tunnels

The SSH Perl implementation Net::SSH::Perl has some support for non-blocking operation but not enough to be run inside a select loop.

I think the best option would be to create the tunnels with IPC::Open2 and to use a unique perl process written around a select loop to control them and listen for new connections.

... though it's not clear to me to what kind of "ssh tunnels" the OP refers, if he is talking about using the stdin and stdout of the ssh process to tunnel data (as in tar cf - . |ssh foo tar xf -) or using ssh native support for tunnels (i.e. ssh foo -L1234:host:1234)

Replies are listed 'Best First'.
Re^3: Forking server for ssh tunnels
by tinypig (Beadle) on Feb 26, 2006 at 17:18 UTC
    Yes, I think what you're suggesting sounds like what we should have been doing in the first place. I will look along those lines.

    As to the hows, we're doing:

    my $pid = open $f, "-|" or exec @cmd; # Where @cmd contains the path to the ssh binary and arguments for the creation of an ongoing tunnel.

    Still not sure if I'm giving enough information, but you guys have helped put me on a better track, I think.