InfoConnect for Unisys
Convert from Telnet to SSL/TLS

You can set up applications that automatically convert Telnet sessions to secure sessions. This sample shows how to convert an IBM terminal session that is configured to connect through telnet to an SSL/TLS connection when its session document file is opened.

The sample only converts sessions that have a specific host address. 

To automatically convert Telnet sessions to SSL/TLS

  1. In Visual Studio, create a new Console Application project and add references for the following InfoConnect assemblies. (Depending on your version of Visual Studio, these can be found either on the .NET tab or under Assemblies | Extensions.)
  2. Replace all the code in the Program.cs file with the following code. This code converts IBM Telnet sessions with a specific host name to SSL/TLS sessions.
    Convert Telnet to SSL/TLS
    Copy Code
    using System;
    using Attachmate.Reflection.Framework;
    using Attachmate.Reflection.Emulation.IbmHosts;
    using Attachmate.Reflection.UserInterface;
    namespace CreateSessionFromExistingSessionFile
        class Program
            //Change these placeholders for your host
            static string yourHostName = "yourHostName";
            static string yourDomainName = "";
            static int yourPort = 723; //Replace with your port
            static public void frame_View_Opened(object sender, EventArgs args)
                IFrame frame = (IFrame)sender;
                IView view;
                //wait for the view
                while ((view = frame.SelectedView) == null)
                //check for the IbmTerminal type
                if (view.Control.ToString() == "Attachmate.Reflection.Emulation.IbmHosts.IbmTerminal")
                    IIbmTerminal terminal = (IIbmTerminal)view.Control;
                    //Disconnect and disable autoconnect so we can change security settings
                    if (terminal.IsConnected == true)
                        terminal.AutoConnect = false;
                    //Only change security for sessions that connect to your host
                    if (terminal.EnableTelnetEncryption == false && terminal.HostAddress.Trim().ToUpper().Substring(0, yourHostName.Length) == yourHostName.ToUpper())
                        terminal.EnableTelnetEncryption = true;
                        terminal.TelnetEncryptionVerifyHostName = false;
                        terminal.TelnetEncryptionDisableCRLCheck = true;
                        terminal.HostAddress = yourHostName + "." + yourDomainName;
                        terminal.Port = yourPort;
            static void Main(string[] args)
                //Start a visible instance of InfoConnect or get the instance running at the given channel name
                Application app = MyReflection.CreateApplication("myWorkspace", true);
                IFrame frame = (IFrame)app.GetObject("Frame");
                //Handle the ViewOpened event to make sure the connection uses SSL/TLS
                frame.ViewOpened += new ViewEventHandler(frame_View_Opened);
  3. Assign the variables for yourHostName, yourDomainName, and yourPort.


To test this project

  1. In Visual Studio, press F5 to run this project.
  2. When InfoConnect opens, open an IBM Telnet session that has the host name you configured in the code.
  3. Verify that the session has been converted to an SSL/TLS session.