0

I want to connect to same host with multiple threads and perform some ssh operations. Can we share the channel object between threads. I tried to use but getting error like java.io.ioexception pipe closed, java.io.IOException: inputstream is closed. Then on this link I read that we can't access the different paths of same host with same Channel object. So I suspect that Channel is not thread safe. I am using this jsch

Can someone please help me on this.

Hrushi
  • 163
  • 1
  • 10
  • 1
    See https://stackoverflow.com/q/38915200/850848 or https://stackoverflow.com/q/29267614/850848 – Martin Prikryl Jul 26 '23 at 16:38
  • Does this answer your question? [If I use JSch from more than one thread, how should I use it](https://stackoverflow.com/questions/38915200/if-i-use-jsch-from-more-than-one-thread-how-should-i-use-it) – Martin Prikryl Jul 28 '23 at 17:40
  • yes it cleared for me thanks. we can use it with synchronization block, but better to use one connection for one thread. – Hrushi Aug 03 '23 at 10:41
  • If the linked question and its answer have helped you, consider upvoting them. – Martin Prikryl Aug 03 '23 at 13:15

0 Answers0