WebTcpipRecvClose Function

Action

Retrieves data from the remote host until the connection is closed by the server. Only the first nMaxData bytes are stored into the buffer sData. If sData is set to NULL only the internal buffers are used for retrieval.

Include file

WebAPI.bdh

Syntax

WebTcpipRecvClose( in  hWeb      : number,
                   out sData     : string optional,
                   in  nMaxData  : number optional,
                   out nReceived : number optional): boolean;

Return value

  • true if the server sent data and closed the connection gently

  • false otherwise

Parameter Description
hWeb Valid handle to a Web connection that was created by WebTcpipConnect.
sData

Buffer to store the received data (optional).

This field also can be set to NULL to use only internal buffers, for example, if data is not to be parsed.

nMaxData

Maximum amount of bytes to store into sData (optional). Specify STRING_COMPLETE to get all received data.

This value has no affect if sData = NULL.

nReceived Parameter that receives the actual amount of data received from the server (optional). Use NULL if value is not needed.

Example

dcltrans
  transaction TWebApplevel
  var
    hWeb : number;
    nRecv : number;
  begin
    // Get the root HTML page of the Web server defined
    // by standardhost with a custom client header
    WebTcpipConnect(hWeb, "standardhost", WEB_PORT_HTTP);
    WebTcpipSend(hWeb, "GET / HTTP/1.0\r\n"
       "User-Agent: CustomClient/1.0\r\n"
       "Accept: */*\r\n\r\n");
    WebTcpipRecvClose(hWeb, 0, 0, nRecv);
    WebTcpipShutdown(hWeb);
  end TWebApplevel;

Sample scripts

WebFileUpload01.bdf, WebMulti01.bdf, WebSecure01.bdf, WebTcpipHttp01.bdf, WebTcpipWebStone01.bdf