Archived Forum Post

Index of archived forum posts

Question:

SSH Remote Terminal Question

Feb 27 '13 at 18:05

I have an application can have multiple concurrent SSH connections running at the same time sending and receiving data to/from a dummy terminal on a Linux PC. The issue I'm having is when one of the connections shuts down they ALL stop receiving.

When I request a shell for each connection, do they all connect to the same dummy shell or are they separate shells? I would expect them to be separate shells.


Answer

If you have one instance of the SSH object where each thread has opened a shell session, then there is only one TCP/IP socket connection with the SSH server. (This is always the case: an instance of the SSH object can have at most one TCP socket connection.) However, the SSH protocol is such that you can have several logical channels on the same connection (i.e. several shell sessions). I'm not sure exactly what you mean by "connection shuts down", but if it's the TCP socket connection shutting down, then certainly all of the logical channels on that connection will also be closed.

If you have a separate instance of the SSH object for each connection, then they should be completely independent of each other.


Answer

I have a multiple instances and am running separate connections with one channel each per connection. When an operation is completed for any particular channel my GUI shutsdown and disconnects that connection.