WebTcpipSelect Function

Action

Checks if a subsequent WebTcpipRecv operation on the provided connection handle will block, or succeed immediately. If the timeout parameter is provided the function call waits until the subsequent WebTcpipRecv function will not block anymore or the timeout expires. A WebTcpipRecv operation succeeds, if data is available or the connection has been closed by the remote host.

Include file

WebAPI.bdh

Syntax

WebTcpipSelect( in hWeb     : number,
                in fTimeout : float ): boolean;

Return value

  • true if a subsequent WebTcpipRecv operation will not block.

  • false if the timeout expires.

Parameter Description
hWeb Valid handle to a Web connection that was created by WebTcpipConnect.
fTimeout Time in seconds the WebTcpipSelect function will wait until the described condition occurs. If this condition cannot be met in the specified time, false is returned. (Default is 0, which means, that the WebTcpipSelect function will not block, regardless if it returns true or false). Specify TIMEOUT_INFINITE if you do not want a timeout to occur.

Example

dcltrans
  transaction TMain
  var
    hWeb : number;
    sResponse : string(1000);
  begin
    WebTcpipConnect(hWeb, "server", 80);
    WebTcpipSend(hWeb, "GET / HTTP/1.0\r\n\r\n"); 
    while not WebTcpipSelect(hWeb, 1.0) do
      print("no data yet ");
    end;
    WebTcpipRecvClose(hWeb, sResponse);
    WebTcpipShutdown(hWeb);
  end TMain;