WebSetTimeout Function

Action

Specifies timeouts for Silk Performer's replay engine. Timeouts can occur either if data cannot be sent to the server in a specified time interval, or if data cannot be received from the server. For both cases, the default setting is to report no timeout.

Include file

WebAPI.bdh

Syntax

WebSetTimeout( in nFlag : number,
               in nTime : number ): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
nFlag

Specifies which timeout value to set. Possible options are:

  • WEB_TIMEOUT_SEND. Specify a value for timeout reported when data cannot be sent to the server. Set nTime to 0 to wait forever (or until the connection is closed).

  • WEB_TIMEOUT_RECV. Specify a value for timeout reported when no data can be received from the server. Set nTime to 0 to wait forever (or until the connection is closed).

  • WEB_TIMEOUT_CONNECT. Specify a value for timeout reported when a connection to a server cannot be established. Set nTime to 0 to use the system's default time out.

nTime Timeout value in milliseconds

Example

dcltrans
  transaction TWebSetTimeout
  var
    hWeb: number;
  begin
    // report timeout when data cannot be received within 30 seconds
    WebSetTimeout(WEB_TIMEOUT_RECV, 30000);
    WebTcpipConnect(hWeb, "192.231.34.1", WEB_PORT_HTTP);
    WebTcpipSend(hWeb, "GET / HTTP/1.0\r\n"
                "User-Agent: CustomClient/1.0\r\n"
                "Accept: */*\r\n\r\n");

    // timeout if less than 100 bytes are received
    WebTcpipRecvExact(hWeb, NULL, 100);
    WebTcpipShutdown(hWeb);
  end TWebSetTimeout;

Sample scripts

AsyncOdb.bdf, Factory.bdf, AsyncFact.bdf