InfoConnect for Airlines
Create a New Session

This sample program creates a completely new host session that is visible in the workspace

To create a new session

  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.)
    Attachmate.Reflection.Framework
    Attachmate.Reflection.Emulation.IbmHosts
    Attachmate.Reflection.Emulation.OpenSystems
    Attachmate.Reflection
  2. If you are using an ALC, UTS, or T27 terminal, create a session path. This sample uses the following path IDs:
    ALC: UPDFRAD
    UTS: INT1_1
    T27: TCPA_1
  3. Replace all the code in the Program.cs file with the following code for the terminal you are using.
  4. If you are using OpenSystems, change the placeholder value "YourHostName" to the host name or IP address for your system.

                        

    Create a new session
    Copy Code
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Attachmate.Reflection.Framework;
    using Attachmate.Reflection.Emulation.IbmHosts;
    using Attachmate.Reflection.UserInterface;
    
    namespace CreateASession
    {
    
        class Program
        {
            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);
    
                //Create a terminal for an Ibm 3270 session
                IIbmTerminal terminal = (IIbmTerminal)app.CreateControl(new Guid("{09E5A1B4-0BA6-4546-A27D-FE4762B7ACE1}"));
    
                //Specify the host name or IP address
                terminal.HostAddress = "demo:ibm3270.sim";
    
    
                //To create a 5250 terminal, use the following lines to get a terminal and specify the host name
                //IIbmTerminal terminal = (IIbmTerminal)app.CreateControl(new Guid("{AF03A446-F278-4624-B9EF-C896DF2CA1CA}"));
                //terminal.HostAddress = "demo:ibm5250.sim";
    
                //Specify the port number and connect
                terminal.Port = 623;
                terminal.Connect();
    
                //Create a View to make the session visible                
                IFrame frame = (IFrame)app.GetObject("Frame");
                frame.CreateView(terminal);
            }
        }
    }
    
    Create a new session
    Copy Code
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Attachmate.Reflection.Framework;
    using Attachmate.Reflection.Emulation.OpenSystems;
    using Attachmate.Reflection.UserInterface;
    
    namespace CreateASession
    {
        class Program
        {
            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);
    
                //Create a terminal for an Open Systems session
                ITerminal terminal = (ITerminal)app.CreateControl(new Guid("{BE835A80-CAB2-40d2-AFC0-6848E486BF58}"));
    
                //Specify the connection type, host name (or IP address), and connect.
                IConnectionSettingsTelnet conn = (IConnectionSettingsTelnet)terminal.ConnectionSettings;
                conn.HostAddress = "yourHostName";
                terminal.Connect();
    
                //Create a View to make the session visible                
                IFrame frame = (IFrame)app.GetObject("Frame");
                frame.CreateView(terminal);
            }
        }
    }
                                       
    
                                        
    
                           

                           

    Create a new session
    Copy Code
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Attachmate.Reflection.Framework;
    using Attachmate.Reflection.Emulation.ALC;
    using Attachmate.Reflection.UserInterface;
    
    
    namespace QuickStartCreateALC
    {
    
        class Program
        {
            static void Main(string[] args)
            {
                //Create an visible instance of the application object
                Attachmate.Reflection.Framework.Application app = MyReflection.CreateApplication("myWorkspace", true);
    
                //Create a terminal
                IAlcTerminal terminalALC = (IAlcTerminal)app.CreateControl(new Guid("{0327C7A7-820D-4F9F-8BD6-11E0398605F1}"));
    
                //Specify the path ID and connect.
                terminalALC.PathId = "UPDFRAD";
                terminalALC.Connect();
    
                //Make the session visible                 
                IFrame frame = (IFrame)app.GetObject("Frame");
                IView sessionViewALC = frame.CreateView(terminalALC);
    
            }
        }
    }
    
    Create a new session
    Copy Code
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Attachmate.Reflection.Framework;
    using Attachmate.Reflection.UserInterface;
    using Attachmate.Reflection.Emulation.UTS;
    
    
    namespace AlcQuickStart
    {
    
    
        class Program
        {
            static void Main(string[] args)
            {
                //Create an visible instance of the application object
                Attachmate.Reflection.Framework.Application app = MyReflection.CreateApplication("myWorkspace", true);
    
                //Create a terminal
                IUtsTerminal terminalUTS = (IUtsTerminal)app.CreateControl(new Guid("{C8ADCD4F-3DF8-4BCA-821B-995FEF8DAFEF}"));
    
                //Specify the path ID and connect.
                terminalUTS.PathId = "INT1_1";
                terminalUTS.Connect();
    
                //Make the session visible                 
                IFrame frame = (IFrame)app.GetObject("Frame");
                IView sessionViewUTS = frame.CreateView(terminalUTS);
    
            }
        }
    }
    

    To test this project

    • Press F5 to run the project and verify that the session opens.