Is there a limit to how many channels can be open per session in JSch ? The cannels I am trying to open are of type "ChannelShell"
I get an "com.jcraft.jsch.JSchException: channel is not opened." exception when I try to open the eleventh channel i.e. channel[10] Does this mean that I can have up to 10 channels per session?
P.S. I dont understand how to meet stackoverflow's quality standards.
A Session represents a connection to a SSH server. One session can contain multiple Channel s of various types, created with openChannel(java. lang. String) . A session is opened with connect() and closed with disconnect() .
public abstract class Channel extends Object implements Runnable. The abstract base class for the different types of channel which may be associated with a Session . It should be considered an implementation detail that Channel implements Runnable – external code never has to invoke the run() method.
public class JSch extends Object. This class serves as a central configuration point, and as a factory for Session objects configured with these settings. Use getSession to start a new Session. Use one of the addIdentity methods for public-key authentication. Use setKnownHosts to enable checking of host keys.
setServerAliveInterval. public void setServerAliveInterval(Integer serverAliveInterval) Sets the timeout interval (milliseconds) before a server alive message is sent, in case no message is received from the server. Parameters: serverAliveInterval - The server alive interval.
OpenSSH's sshd had such a restriction to allow only 10 channels simultaneously, and recent its sshd has introduced the flag 'MaxSession' to sshd_config.
Refer to "man sshd_config",
MaxSessions
Specifies the maximum number of open sessions permitted per net-
work connection. The default is 10.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With