Difference between using SendCommand and using Send(FunctionKey.Enter)

0 votes
asked 4 days ago by daipon (120 points)

Hi, I want to know if there is any difference of two cases below.

case1: using SendCommand

scripting.SendCommand(command)  

case2: using Send(FunctionKey.Enter)

scripting.Send(command)
scripting.Send(FunctionKey.Enter)

In AIX7.2, response timeout error occurred.

(After sending command, I used ReadUntilPrompt or ReadUntil(ScriptEvent.Prompt). I did DetectPrompt beforehand.)

It looks like case1 working well, but case2 not working.
In command history, I found the command in case1, but in case2 I could not find the command.
So I think FunctionKey.Enter doesn`t work well in some environment.
But then, how SendCommand working well?

1 Answer

0 votes
answered 4 days ago by Pavel Matyska (10,500 points)

Hi,

major difference is that SendCommand also reads server echo of the command, but combination of two Send methods leave the command echo as is. So when you call ReadUntilPromp the output of the command can start with the command itself. This happens when two Send methods was used.

In terms what you are asking both cases should in most cases complete with same result with the difference mentioned above. In case your scripting.Terminal.Options.TerminalType is set to Wyse60, the server can redefine what it needs to be sent for an Enter. In that case we send what the server demanded. But I assume that it is not your case, is it?

Please try this with latest version. You can download trial version of it at Terminal Emulation download page.
If the issue is still present, please create a log as in sample code below and send it back to us for analysis.

        //connect and loggin using Ssh or Telnet client
        // ...

        // client is an instance of Ssh or Telnet class
        client.LogWriter = new FileLogWriter(@"C:\Temp\send-issue.log", LogLevel.Verbose);
        scripting.SendCommand(command);
        scripting.ReadUntilPrompt();

        scripting.Send(command);
        scripting.Send(FunctionKey.Enter);
        scripting.ReadUntilPrompt();
...