0 votes
by (150 points)
closed by

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?

closed with the note: Solved.

1 Answer

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

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();
by (150 points)
Thank you.

I confirmed SendCommand method and Send(FunctionKey.Enter) method are actually working well.

The problem was in a different place.

scripting.SendCommand("\n")

I used this to skip past input, but the character of "\n" made problem in Aix.
I changed this.

scripting.SendCommand("")

Then everything worked well.

Thank you.
by (73.6k points)
SendCommand() appends 'Enter' automatically, so scripting.SendCommand("\n") will send two 'Enter's.

As you wrote, the scripting.SendCommand("") is correct solution.
...