0

I am accessing an embedded linux SBC to execute and interact with a CLI application. This works with OpenSSH (on Windows10) to launch the application then the application accepts text commands and generates responses.

Trying this in a WinForm app there is no reply when the CLI application is called. On launch the expected reply is ">" but I receive nothing. Subsequent CLI application commands "config get parameter1" would get a reply "param1.value".

c# to test the problem.

    private void ButtGetParam1_Click(object sender, EventArgs e)
    {
        try
        {
            var command = "su myApplication 192.168.10.1:30000";
            if (client != null && client.IsConnected)
            {
                var cmd = client.CreateCommand(command);
                var cmdResponse = cmd.Execute();
                listBox1.Items.Add(cmdResponse);

                command = "config get parameter1";
                cmd = client.CreateCommand(command);
                cmdResponse = cmd.Execute();
                listBox1.Items.Add(cmdResponse);
            }
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message, "Date read Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }

I have tried CreateShellStream with no success. I found prepending "su" to the first command ensured the C# app got a reply from the remote application.

  • @Martin Prikryl I saw that lin but I failed to get the point, me fault I expect :) I'll go try again. Thanks again – Matt Baker Mar 29 '22 at 14:43

0 Answers0