Using the VirtualTerminal.SendToServer sub is there any way to send linux encoded function keys instead of sending the windows encoding as a string? Or perhaps another method for sending it as a virtual key?

asked 07 May '10, 17:26

Allan's gravatar image

Allan
161
accept rate: 0%

edited 06 Oct '10, 12:12

Rebex%20KB's gravatar image

Rebex KB ♦♦
258519


To send function key recognizable by the remote end you can use the SendToServer(ConsoleKeyInfo) method with FunctionKeysMode set apropriately. Please note that there is a lot of function keys mode (in real word), you have to choose correct one for your particular server.

// send function key F10 using standard predefined Linux convetions
virtualTerminal.Options.FunctionKeysMode = FunctionKeysMode.Linux;
virtualTerminal.SendToServer(new ConsoleKeyInfo('\0', ConsoleKey.F10, false, false, false));

To send text encoded with your preferred encoding, you have to set the Options.Encoding property.

// send some text encoded by specific encoding (new line seqence set to <CR> instead of <CR><LF>)
virtualTerminal.Options.Encoding = System.Text.Encoding.GetEncoding("requested encoding name or codepage");
virtualTerminal.Options.NewLineSequence = NewLineSequence.CR;
virtualTerminal.SendToServer("some text");

Finally, you are able to send raw bytes to the server directly.

// prepare the data
byte[] rawData = new byte[4];
// ...
// send bytes directly to the server
virtualTerminal.SendToServer(rawData, 0, rawData.Length);
link

answered 10 May '10, 08:10

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:

×6
×5
×5
×2

Asked: 07 May '10, 17:26

Seen: 1,110 times

Last updated: 06 Oct '10, 12:12