Thanks Aris. So, that means, everytime I want to execute a remote command, if I create a separate thread, and create a new session and a channel dedicated for this thread, then executing remote command with this session/channel will be safe, and each thread will work fine without impacting others, right?
Why I asked that use case is for performance concern, my program will rely on libssh to do a lot of remote command execution on the same remote host, and each command will be done in a separate thread. So in each thread, creating a dedicated session/channel and do the login with username/password looks not good from performance point view, so I am wondering if I can keep a global session/channel, and just do login one time before I create any threads to execute any command remotely. Any suggestions on my use case? Thanks!
