Hello Support,
I am building an app that will wake up, connect to a terminal server, do some work, sleep and then repeat. I can get it to run once without issue. However, when I create the second set of TelnetClient and VirtualTerminal classes, it will connect but it won't update the internal screen. What am I doing wrong?
The relevant code is below
public void Connect(string server, int port)
{
Server = server;
Port = port;
emulatorStateChanged(MinxEmulatorStates.Connecting);
telnetClient = new TelnetClient(server, port);
tControl = new VirtualTerminal(telnetClient);
tControl.NewLineType = ComponentPro.Net.Terminal.TerminalNewLineType.CRLF;
tControl.KeysMode = ComponentPro.Net.Terminal.TerminalKeysMode.VT100Plus;
tControl.StateChanged = new System.EventHandler(this.tControl_StateChanged);
telnetClient.CreateShellCompleted = TelnetClient_CreateShellCompleted;
telnetClient.CreateShellAsync();
}
private void TelnetClient_CreateShellCompleted(object sender, ComponentPro.ExtendedAsyncCompletedEventArgs e)
{
MinxLogger.WriteEntry(MinxLogger.MinxLoggerType.Debug, "Emulator tControl state changed: ");
if((e.Cancelled) || (e.Error != null) || (e.Result == null))
{
Stop();
emulatorStateChanged(MinxEmulatorStates.Disconnected);
}
else
{
terminalShell = e.Result;
terminalShell.Timeout = Timeout;
Run();
emulatorStateChanged(MinxEmulatorStates.Connected);
}
}
public void Disconnect()
{
VirtualTerminal term = null;
if (terminalShell != null)
{
terminalShell.Close();
terminalShell = null;
}
if (tControl != null)
{
tControl.Screen.Clear();
tControl.Dispose();
}
if(telnetClient != null)
{
telnetClient = null;
}
emulatorStateChanged(MinxEmulatorStates.Disconnected);
}
asked 5/22/2020 2:04:20 AM