Sets an option for sockets.

C Language

int web_set_sockets_option( const char *option, const char *value ); 

Java Language

int object.set_sockets_option( String option, String value ); 
An expression evaluating to an object of type WebApi. Usually web for Java. See also Function and Constant Prefixes.
The option whose value you want to set.
The value of the specified option.

Return Values

This function returns LR_PASS (0) on success, and LR_FAIL (1) on failure.


The following argument(s) can be parameterized using standard parameterization: OptionID, OptionValue

General Information

The web_set_sockets_option function configures options for sockets on the client machine. This function supports socket-level replay. In the Web HTML protocol, it supports both HTML-based scripts (Mode=HTML) and URL-based scripts(Mode=HTTP modes). web_set_sockets_option has no effect on replay using WinInet.

To print a list of the supported options, specify the HELP flag with a null string and execute the function. A list of all the available options is displayed in the Output window's Execution log.

For options that enable or disable a feature (such as TRACE_SSL_IO), specify "1" to enable and "0" to disable.

Supported Options
Only allows requests to servers in the list. (see also DISALLOW_HOSTS option). Only use under Sockets. Do not use wildcards or other regular expressions in value.
If server has aborted the connection while we were reading from the socket, treat it as if the socket has been closed (true by default).
Closes all open connections.
A directory containing a list of Certificate Authority files (in PEM format).
Timeout to wait for useless body. An example would be the body of an HTTP 302 response (Moved Temporarily). The default is 2 seconds.
Ignores all requests to the listed servers. This option is useful for excluding resources that come from external sites. For example, you can use this option to exclude advertisements that are hosted on external servers. Only use under Sockets. Do not use wildcards or other regular expressions in value.
Output information about the available options to the execution log. This is useful during development. Use an empty string ("") for value.
Do not consider server closing the connection prematurely as error (false by default).
INITIAL_AUTH Force sending user credentials with the first request without waiting for HTTP 401. For example, web_set_sockets_option("INITIAL_AUTH", "NTLM");
Sets the IP address of the client machine to be the nth address on the client machine. This option is useful for IP spoofing. If this option is used, lr_get_vuser_ip returns the IP set with this call.
Load the certificate file in PEM–format. The file contains a list of Certificate Authorities.
Specifies the maximum number of concurrent connections per host.
Specifies the global maximum number of simultaneous connections per Vuser.
Set the TCP_NODELAY option on the socket – it will prevent the socket from accumulating small buffers to larger ones before sending (false by default).
Prevent starvation from sockets (false by default).
If overlapped send is available, use IBM specific method (false by default). Use when there are retries in the transaction breakdown results an IBM server.
Use the real client host name in NTLM authentication instead of the default 'dummy_host'. Set to "1" to activate. Default is "0".
When set to 0, this option disables the breakdown of the "First Buffer" into server and network time. The breakdown remains disabled until you enable it by setting the option's value to 1.
This option is primarily used when encountering the following error: "Error -27740: overlapped transmission of request". Place the following statement web_set_sockets_option("OVERLAPPED_SEND", "0") at the beginning of the script, to prevent this error.
Print information about SSL connections to brief log. Value of zero in quotes ("0") suppresses output. Any other integer (for instance, "1", "–3", and so forth) enables output.
Output a list of IP addresses available on a given machine to the execution log. value is the name of the machine.
PROXY_INITIAL_AUTH Force sending user credentials to proxy server with the first request. For example, web_set_sockets_option("PROXY_INITIAL_AUTH", "NTLM");
If enabled, send basic authentication to proxy before receiving 407 error. If disabled, send the regular header in the first request. By default, PROXY_INITIAL_BASIC_AUTH is enabled.
Controls how ports are shutdown and disconnected from the TCPIP connection: GRACEFUL (default), FAST, or ABRUPT. See Shutdown Mode Option.
Enable the reuse of ports (currently not supported).

A list of colon–delimited SSL ciphers to use for SSL connections. For the list of ciphers, see the SSL_CIPHER_LIST options.

False by default
The SSL version preference: '2', '3', '2&3', 'TLS', 'TLS1.1', or 'TLS1.2'
Uses a strong pseudo–random number generator to generate SSL keys. (disabled by default) Although the standard (non–strong) random number generator is more predictable, it is more efficient.
Warning: This option is not thread–safe.
Specify blocking connect.
Set the TCP send and receive buffer size.

The Server Name Indication (SNI) extension configuration. One of:

  • 1 - Enable extension (default)
  • 0 - Disable extension
  • <server name> - If a server name is specified, that server name is used once: for the next handshake. After the next handshake, the option reverts to the previous setting, 1 or 0.
Performs a raw trace of all bits sent through the SSL connection.
Set maximum chunk size for large request body (default is 64*1024 bytes).
Use standard select() instead of Micro Focus's responsive select (false by default).
Sets the preferred IP address of client <ip_addr>[:<port>]. This option is useful for IP spoofing.

This function is supported for all Web scripts. The USER_IP_ADDRESS setting is supported under WSP.

The supported ciphers for SSL_CIPHER_LIST are:


Shutdown Mode Option

Some clients and servers do not terminate connections cleanly. The result is that connections may get trapped in wait states during tests, draining networking resources. The following options are provided to solve this problem. The correct choice depends on your system and networking environment.

GRACEFUL (default) – a full shutdown sequence. This is the normal mode of shutdown – a 4–way handshake between the web client and server. If any of the following occur, consider changing to the ABRUPT option:

ABRUPT: a reset packet is sent to the Web server causing it to close the connection. Note, however, that servers sometimes do not receive the packet or do not successfully execute cleanup operations. This usually results in dead connections.

FAST: a compromise between GRACEFUL and ABRUPT. A full shutdown sequence is initiated by the Web client with a very fast timeout.