Web Vuser Functions (WEB) > Alphabetical List of Web Vuser Functions > web_set_sockets_option

web_set_sockets_option

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 ); 
Argument
Description
object
An expression evaluating to an object of type WebApi. Usually web for Java. See also Function and Constant Prefixes.
option
The option whose value you want to set.
value
The value of the specified option.

Return Values

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

Parameterization

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
ALLOW_ONLY_HOSTS
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.
CHECK_CONNECTION_ABORT_DURING_RECEIVE
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).
CLOSE_KEEPALIVE_CONNECTIONS
Closes all open connections.
DEFAULT_VERIFY_PATH
A directory containing a list of Certificate Authority files (in PEM format).
DESPAIR_TIMEOUT
Timeout to wait for useless body. An example would be the body of an HTTP 302 response (Moved Temporarily). The default is 2 seconds.
DISALLOW_HOSTS
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.
HELP
Output information about the available options to the execution log. This is useful during development. Use an empty string ("") for value.
IGNORE_PREMATURE_SHUTDOWN
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");
IP_ADDRESS_BY_INDEX
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_VERIFY_FILE
Load the certificate file in PEM–format. The file contains a list of Certificate Authorities.
MAX_CONNECTIONS_PER_HOST
Specifies the maximum number of concurrent connections per host.
MAX_TOTAL_CONNECTIONS
Specifies the global maximum number of simultaneous connections per Vuser.
NO_DELAY
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).
NO_STARVATION
Prevent starvation from sockets (false by default).
NEW_BEHAVIOR_OF_OVERLAPPED_SEND
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.
NTLM_USE_REAL_CLIENT_HOST_NAME
Use the real client host name in NTLM authentication instead of the default 'dummy_host'. Set to "1" to activate. Default is "0".
OVERLAPPED_SEND
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_SSL_INFO
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.
PRINT_USER_IP_ADDRESS_LIST
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");
PROXY_INITIAL_BASIC_AUTH
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.
SHUTDOWN_MODE
Controls how ports are shutdown and disconnected from the TCPIP connection: GRACEFUL (default), FAST, or ABRUPT. See the Shutdown Mode Option.
SO_REUSE_ADDRESS
Enable the reuse of ports (currently not supported).
SSL_CIPHER_LIST

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

SSL_NO_PROXY_TUNNEL
False by default
SSL_VERSION
The SSL version preference: '2', '3', '2&3', 'TLS', 'TLS1.1', or 'TLS1.2'
STRONG_PRNG
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.
SYNCHRONOUS_CONNECT
Specify blocking connect.
TCP_BUFFER_SIZE
Set the TCP send and receive buffer size.
TLS_SNI

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.
TRACE_SSL_IO
Performs a raw trace of all bits sent through the SSL connection.
UPLOAD_CHUNK_SIZE
Set maximum chunk size for large request body (default is 64*1024 bytes).
USE_SELECT
Use standard select() instead of HP's responsive select (false by default).
USER_IP_ADDRESS
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.

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.