Hi, >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?
Zhang, Aris I have a similar use case such as above, have just implemented the above scenario in my own code but there are other changes in the code before I can comment on how well this works or doesn't. In the meantime would be great to hear on what is the recommended approach in the following scenarios : - a server that needs to to accept connections from multiple hosts - each connection would then have multiple requests it would have to service (mostly sequential but may also be in parallel) Thanks guys. Bye for now Jeetu ebrain.in | Beehive Computing Discover and run software from any device around you - an open source (GPL) project. On Fri, May 20, 2011 at 9:12 PM, Zhang Qian <[email protected]> wrote: > 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! >
