TE_connect

Example: TE_connectTerminal Emulator Connection Functions

Connects the terminal emulator to the specified host. (Windows only)

int TE_connect( const char *com_string, unsigned int timeout );
com_string A string that contains the details used to connect an RTE script with a host. The string may contain the host name, and the communication type. The actual contents of the string will depend on the type of communication specified.
timeout The maximum time (in milliseconds) to wait for the terminal emulator to connect to the specified host.

The TE_connect function is generated by VuGen when you record a connection to a host. The contents of com_string are used for connecting to the host.

If the first attempt to connect is not successful, several retries are attempted to connect successfully. To set the maximum number of times that a script tries to connect, enter a number in the Maximum number of connection attempts box on the RTE tab of the Runtime settings dialog box.

Details of each connection are recorded in the report file output.txt.

For example: Connect succeeded on try 1: comm–type = tn5250;host-name = as400;

Note 1: The TE_connect function must always be recorded into a script. Do not type or paste the function into a script. When you record a connection, PowerTerm creates various files in the script directory. These files contain various settings that describe the connection.

Note 2: Do not include more than one TE_connect statement in a script. The second TE_connect statement will fail with an "already connected" error.

Note 3: The TE_connect function must always be the first function in the vuser_init section of the script.

Return Values

This function returns 0 if it succeeds, and a negative error code if it fails. It also sets the global variable TE_errno. TE_find_text does not print an error message when it fails.

Parameterization

The following argument can be parameterized using standard parameterization: com_string