This sample shows how to create an InfoConnect Open Systems session that connects through the Secure Shell (SSH) protocol.
Set up SSH Connection |
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 CreateSSHSession { 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}")); //Disable autoconnect and then disconnect so the default settings can be changed terminal.AutoConnect = false; terminal.Disconnect(); //Set the terminal to use secure shell IConnectionSettingsSecureShell conn = (IConnectionSettingsSecureShell)terminal.ConnectionSettings; terminal.ConnectionType = ConnectionTypeOption.SecureShell; //Specify the host name or IP address, port, and user name. conn.HostAddress = "yourHostAddress"; conn.SSHPort = 22; conn.UserName = "yourUserName"; //Make the session visible IFrame frame = (IFrame)app.GetObject("Frame"); frame.CreateView(terminal); //Connect with the new SSH settings terminal.Connect(); } } } |