private void TelnetInitialConnect( string ServerName, bool AutoConnect, string DeviceName, string TerminalType) { var host = ServerName; int port = 23; SessionSettings sessionSettings = null; // already connected. if (this.ConnectPack?.IsConnected() == true) { MessageBox.Show("already connected to telnet server."); return; } MainWindow.LogFile.ClearFile(); // TelnetNegotiateSettings // - WILL EOR // - WILL TERMINAL TYPE // - TERMINAL TYPE // - user name, terminal name // TelnetCommand.Negotiate( negotiateSettings ) // returns TelnetSessionAttributes // after negotiate, call method to send and receive 5250 DataStreamHeader // followed by escape 04 orders // code is receive 5250 command, render to screen, wait for screen AID key, // send 5250 command response. var negSettings = NegotiateSettings.Build5250Settings( "SRICHTER", DeviceName, TerminalType); // connect to the server. var rv = ConnectToServer_StartServerThreads(ServerName, port); this.ConnectPack = rv.Item1; sessionSettings = rv.Item2; if (this.ConnectPack.IsConnected() == true) { // send message to connect thread. This will run telnet device startup // processing on a backround thread. This way problems do not lock up // the UI. { var startupMessage = new TelnetStartupMessage( this.TelnetQueue, this.ConnectPack, negSettings, this, MainWindow_TelnetStartupComplete, TypeTelnetDevice.Terminal); this.ConnectThread.PostInputMessage(startupMessage); } } }
private void TelnetPrinterConnect(string ServerName) { var host = ServerName; int port = 23; SessionSettings sessionSettings = null; // already connected. if (this.ConnectPack?.IsConnected() == true) { MessageBox.Show("already connected to telnet server."); return; } MainWindow.LogFile.ClearFile(); var negSettings = NegotiateSettings.Build5250Settings( "SRICHTER", "STEVE41P", "IBM-3812-1"); // var negSettings = NegotiateSettings.Build5250Settings( // "SRICHTER", "STEVE42P", "IBM-5256-1"); // connect to the server. var rv = ConnectToServer_StartServerThreads(ServerName, port); this.ConnectPack = rv.Item1; sessionSettings = rv.Item2; if (this.ConnectPack.IsConnected() == true) { // send message to connect thread. This will run telnet device startup // processing on a backround thread. This way problems do not lock up // the UI. { var startupMessage = new TelnetStartupMessage( this.TelnetQueue, this.ConnectPack, negSettings, this, MainWindow_TelnetStartupComplete, TypeTelnetDevice.Printer); this.ConnectThread.PostInputMessage(startupMessage); } } }