The app I'm working on requires that the last thing it does is sends 2 escape keys. I have tried

 dim myByte as byte = "27"
 terminal.sendtoserver(myByte,0)

and

terminal.SendToServer(New ConsoleKeyInfo("\0", ConsoleKey.Escape, False, False, False))

and

terminal.SendToServer(New ConsoleKeyInfo("", ConsoleKey.Escape, False, False, False))

all 3 with and without

    Do
        state = terminal.Process(500)
    Loop While state = TerminalState.DataReceived

in between the 2 escape keys. Methods 1 and 3 are typing the escape key unicode sequence instead of sending as a key press, depending on the function key mode set (Linux, LinuxAlternative, Common, XtermR6, all work for the F-keys that the app uses) either as "0[21~" or "[21~", after the second escape key is sent. Method 2 is writing "" to the screen for both key presses.

asked 15 Nov '11, 20:58

Allan's gravatar image

Allan
161
accept rate: 0%

edited 15 Nov '11, 21:55


You were quite near. The code should look like this:

terminal.SendToServer(New ConsoleKeyInfo(Chr(27), ConsoleKey.Escape, False, False, False))

It is because the ConsoleKey.Escape value is not handled by the terminal explicitly, so the ConsoleKeyInfo.KeyChar is used. Actually, it is easy to handle ConsoleKey.Escape in terminal, so I will add this functionality. All your cases will work in the next release.

Basically, you want to send a string which contains two escapes. The easiest way is the following:

VB .NET

terminalSendToServer(Chr(27) & Chr(27))

C#

terminal.SendToServer("\x1B\x1B");
link

answered 16 Nov '11, 11:27

Lukas%20Matyska's gravatar image

Lukas Matyska ♦♦
90117
accept rate: 28%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×44
×5

Asked: 15 Nov '11, 20:58

Seen: 681 times

Last updated: 07 Dec '11, 00:39