There are two ways to specify connection information:
1. | Use a predefined host. |
2. | Set the host information at runtime. |
1. | Use a predefined host. |
A host is predefined by using the Admin Console tool.
In order to use the predefined settings the HostConnection object's hostName property needs to be set to the value of Host Identifier. Using the example screenshot above this value would be "Insure".
The following code gives a simple demonstration of opening a connection using the "Insure" settings. Before executing the code, open the Trace Viewer and make sure that the log is cleared by clicking on the "Reset Trace" option so that you can verify that the connection was made and terminated successfully.
The debug output window in the development environment should display the text "Connected!". View the log by clicking the "refresh" option in the Trace Viewer.
2. | Set the host information at runtime. |
It is possible to set the host connection information at runtime. Use the sessionHost, sessionPort and sessionType information to specify the IP number, port number and protocol for the connection. The sessionOptions property allows specific information to be specified, such as the text, and its location, that identifies the first screen after a new connection has been made.
The following code demontrates how to set connection properties at runtime.
As with the previous example, only the text "Connected!" should appear in the debug output window of the development environment.
Important connection setting information
Remember to specify the ConnectTestText, ConnectTestRow, ConnectTestColumn properties correctly before making a connection. These properties allow the emulation engine to identify when a connection to the first screen has completed successfully. If these properties are incorrect the connection process may be delayed by as much as 5 seconds while the settletime period elapses.
Note the "ScreenRowsAlt" and "ScreenColsAlt" settings in sessionOptions. Some hosts have more than one screen size and can switch between the two modes (e.g. from 24 rows by 80 cols to 43 rows by 80 cols). These two properties allow you to specify an alternative screen size.