[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about multithreading with libSSH

By default I believe it's configured to echo back input as if you were in an interactive session. Maybe that's what you're seeing?

Alexander Grotewohl

From: Kennedy, Marcus A. <Marcus.Kennedy@xxxxxxxxxx>
Sent: Wednesday, March 25, 2020 4:07:33 PM
To: libssh@xxxxxxxxxx <libssh@xxxxxxxxxx>
Subject: Question about multithreading with libSSH


Client OS:  Windows 10
Host OS: Linux

User does not enter commands to process but only authenticates.  The
application does the rest.

Think of this like a compilation job for Linux applications that need to
launch from a Windows machine.

Our approach is this:

1)  Link to the Host
2)  run the command "mktemp -d BUILD_XXXXXX" on the Host
3)  read back the directory name mktemp outputs
4)  Copy a couple of tarballs and a script to the Host in the temporary
5)  cd <temporary director>
6)  execute the script
7)  Monitor the output (the script will provide coded status messages
    during the execution).

Originally, we had these commands as ssh_channel_write() within
OnInitDialog(), but that was the reason that the dialog went into
"Not Responding".  So, we added a writer thread.  The reader thread
launches and only calls into ssh_channel_read_nonblocking() with a .5
second wait if no data is present (otherwise, bleed the channel dry).
We started with simply writing mktemp -d BUILD_XXXXXX to the channel
and read back mktemp's response.  To do this, we expected that the
prompt and our command would be on the next line read.  In fact, the
read thread reads what we wrote exactly then the prompt and the command.
If we Sleep(500) launching the thread, we only get back the prompt and

Are there separate buffers on the client side for reading and writing
to a channel?

Should we be seeing the writes if we write and read the channel at the
same time?

Is libSSH thread safe?


RE: [EXTERNAL] Re: Question about multithreading with libSSH"Kennedy, Marcus A." <Marcus.Kennedy@xxxxxxxxxx>
Question about multithreading with libSSH"Kennedy, Marcus A." <Marcus.Kennedy@xxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org