----- Original Message -----
> From: n v prakash reddy via RT <bug-Net-SSH2@rt.cpan.org>
> To:
> Sent: Saturday, June 11, 2016 4:56 AM
> Subject: Re: [rt.cpan.org #115187] Issue with Net::SSH2::Channel
>
> Queue: Net-SSH2
> Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=115187 >
>
> Thank you very much for the support.
> Have few questions:
RT is not a place for asking questions.
PerlMonks or StackOverflow are better places for that. I visit then regularly and will answer your questions there.
> How many channel objects can be created per one Net::SSH2 object
> (connection)?.
Usually, SSH servers limit the number of *concurrent* channels running over a single connection to around 10. But then, as far as you don't reach this limit, you can open and close as many channels as you want over the lifetime of the connection.
> How many shell's we can invoke per one Net::SSH2::Channel object
> (connection)?.
One: once you have invoked one of exec, shell or subsystem in a channel, you can not do it again.
> What shell method in Net::SSH2::Channel is doing?
It starts a remote shell that keeps waiting for commands over its stdin channel which is plugged to the remote side of the channel.
Tipically, on a channel where you have called "shell", you write commands as...
$ssh->write("$cmd\n")
and then read the output until you get back a prompt and then, your write another command, etc.
Anyway this is not a recommended way to use SSH. When possible it is better to use the "exec" method which just runs a single command over a channel. Using is easier to write reliable programs using "exec" than "shell", as talking to the shell can become quite tricky.
> Which object out of Net::SSH2 object, Net::SSH2::Channel object is a actual
> SSH connection?.
Net::SSH2 maintains a TCP connection to the remote hosts and runs the SSH protocol over it.
All the channel objects hanging from a Net::SSH2 object are multiplexed over that single TCP connection.
> Is every channel object is SSH connection to a remote host?.
No
> My Requirement:
> i want to create one SSH connection to a remote machine, and create 100
> channels or 1 channel with 100 shells over one SSH connection created
> earlier.
That's not a very common approach, and as I told you before, the server may limit the number of channels open over a single connection to around 10.
Anyway, probably there is a better way to do what you need without opening 100 concurrent channels.
> Is there a SSH module which will fulfill my requirement?.
Net::SSH2, Net::OpenSSH, Net::SSH::Any and Net::SSH::Perl can do that.