0 votes
by (350 points)

So can I do this:
In thread 1 create the SSHSession and SshChannel.
Also in thread 1 use the SshChannel.Send function.
In Thread 2 use the SshChannel.Poll and SshChannel.Receive functions.

Would the Isocket (SshChannel.ToSocket) interface be ok to use in another thread? ( My guess is the Isocket and SShchannel would be calling the same functions so no different.... Is this correct? )

I am using the Channel to send some binary data (not a file) to an embedded system.

Thanks
Tom

related to an answer for: Best way to read from a SshChannel?

1 Answer

0 votes
by (72.7k points)
selected by
 
Best answer

Yes, the SshChannel class is thread safe in mentioned manner. You can call Send and Poll+Receive concurrently.

Also, ISocket objects created by calling SshChannel.ToSocket() method are thread save in mentioned manner. The ISocket object created this way simply invokes corresponding method on the parent SshChannel object.

I would like to note that calling ISocket.Close() closes the parent SshChannel as well.

...