OpenSTA logo OpenSTA SCL Reference
CONNECT Command

CONNECT Command

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

If a GET, HEAD, or POST uses a connection id that has not been CONNECTed then the TCP connect is done implicitally to the host and port specified in the URL. If you wish to use a proxy for scripted HTTP requests then you must use a CONNECT first to that proxy.

Command Definition:

CONNECT TO host ON conid
	{,RETURNING STATUS connect-status}

host

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.

conid

An integer variable, integer value or integer expression defining the Connection ID. This is used in all subsequent operations on this connection.

connect-status

An integer variable into which the connect status is loaded.

Examples:

CONNECT TO "proxy.osta.lan:3128" ON 1
CONNECT TO Test-Host ON 2
CONNECT TO 'osta.lan' ON Conid

<<<
prev page
^^^
section start
>>>
next page