Hello,
1) to establish the telnet connection there is the Telnet
class. It is best utilized in combination with our powerful Scripting API.
2) connect to Telnet servers
3) when working with the Scripting API, it features scripting.Close();
method
4) sending data and communicating with Telnet servers is most easily done via the Scripting
class. See code sample on Scripting
5) see chapter about reading response from Telnet/SSH servers
6) In the Telnet protocol you cannot send two commands from one Telnet client to the server at the same time, so this does not make sense. If you need to make non-blocking calls to keep your GUI responsive, of course you can call the methods of Telnet/Scripting classes from a dedicated thread. If you need to perform more tasks at once at the server, you need to create a special Telnet connection for each request.
7) Both Bind
and StartScripting
methods internally create a new connection to Telnet server. StartScripting is a method from the Telnet class that you can call (and then it internally creates its own VirtualTerminal object), whereas the Bind method is typically used to bind an existing terminal control (GUI) or virtual terminal (GUI-less) to a Telnet class.
See more details.
8) As long as you do a Telnet.StartScripting
which is recommended, then the Virtual terminal is automatically created for you. The virtual terminal is then accessible as property of Scripting class Scripting.Terminal
.
In more details, Virtual terminal is a class deigned for easy communication with Telnet and SSH servers. You can imagine it as GUI-less virtual terminal. In fact we do not yet offer a GUI terminal control for Xamarin.Android, so the virtual terminal is what you need here. From our documentation:
"VirtualTerminal is a terminal emulation object that is very similar to TerminalControl, but there is one major difference - it's not visible. In fact, it's not even a control. Otherwise, it shares most features with TerminalControl and is suitable for applications that need to interact with SSH or telnet servers but don't need to display the actual terminal session." The powerful Scripting API is built on top of Virtual Terminal and it is a good class to use if you need to script a specific task with Rebex Terminal emulation component.
9) to retrieve a character at a screen position, just use the
Terminal.Screen.GetCell method which returns the TerminalCell
like this:
int column = 10;
int row = 20;
TerminalCell cell = scripting.Terminal.Screen.GetCell(column, row);
and then read TerminalCell
properties:
cell.Underline
cell.Blink
cell.Bold
cell.BackColor
10) to send data to Telnet server and read server response, use these methods:
scripting.Send("data"); // sends the data to server
scripting.SendCommand("data"); // sends the data and newline and then waits for server response
scripting.WaitFor(ScriptEvent.Prompt); // waits for a ScriptEvent condition to be met
scripting.ReadUntil(ScriptEvent.Prompt); // returns data received until a ScriptEvent condition is met
11) The Telnet class has a built-in LogWriter. Another possibility is session recording. The recorded sessions can be later replayed via our ANSI player sample.