This command may be used to establish a TCP connection to a nominated host. It is only valid within a Script that has been defined as MODE HTTP.
This command specifies an ID for the TCP connection. This may be used in subsequent GET, HEAD, POST and LOAD RESPONSE_INFO commands to use this TCP connection. The TCP connection may be closed using the DISCONNECT command. It will also be terminated when the thread exits the Script.
The connection ID specified must not correspond to a TCP connection already established previously using the CONNECT command. Otherwise a Script error will be reported.
The optional "RETURNING STATUS connect_status" clause can be used to specify the integer variable to hold a value indicating whether the CONNECT succeeded or failed. There is an SCL include file "response_codes.inc" supplied with OpenSTA, which defines SCL integer constants for the response status values. When "RETURNING STATUS" is specified, the "ON ERROR" action is disabled.
By default, if an error occurs while establishing the TCP connection or issuing the CONNECT, an error message will be written to the audit log and the virtual user will continue. However, if error trapping is enabled, control will be transferred to the error-handling code
CONNECT TO host ON conid {&} {,RETURNING STATUS connect_status}
A character variable, quoted character string or character expression, containing the host name or IP address of the resource to connect to and, optionally, the port number on which the connection is to be made. If a port is specified, it must be separated from the host field by a colon (":"). If the port number field is empty or not specified, the port defaults to TCP 80.
An integer variable, integer value or integer expression defining the connection ID. This is used in all subsequent operations on this connection.
An integer variable into which the connect status is loaded.
CONNECT TO "proxy.dev.mynet:3128" ON 1 CONNECT TO myhost ON 2 CONNECT TO 'abc.com' ON conid