WebTcpipShutdown Function

Action

Shuts down the connection established by WebTcpipConnect.

Include file

WebAPI.bdh

Syntax

WebTcpipShutdown( inout hWeb  : number,
                  in    nMode : number optional ): boolean;

Return value

  • true if the shutdown succeeded

  • false otherwise

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

Determines the shutdown mode (optional). Any of the following options is possible:

  • WEB_SHUTDOWN_GRACEFUL. Initiates a graceful shutdown: first closes and then resets the connection

  • WEB_SHUTDOWN_IMMEDIATE. Initiates a standard connection close (default)

  • WEB_SHUTDOWN_RESET. Resets the connection

Example

dcltrans
  transaction TWeb
  var
    hWeb      : number;
    sHdr      : string;
    sSize     : string(20);
    nReceived : number;
  begin    WebTcpipConnect(hWeb, "lab3", 80);
    sHdr := "GET /file5k.html HTTP/1.1\r\n"
                  "Host: lab3\r\n\r\n";

    // send HTTP request header
    WebTcpipSend(hWeb, sHdr);

    // receive HTTP response header
    WebTcpipRecvUntil(hWeb, sHdr, STRING_COMPLETE,
                      nReceived, "\r\n\r\n");

    // receive document
    StrSearchDelimited(sSize, STRING_COMPLETE, sHdr,
                       "Content-Length: ",1,"\r\n",
                       1, STR_SEARCH_FIRST);
    WebTcpipRecvExact(hWeb, NULL, number(sSize));

    // reset the persistent connection
    WebTcpipShutdown(hWeb, WEB_SHUTDOWN_RESET);
  end TWeb;

Sample scripts

WebFileUpload01.bdf, WebMulti01.bdf, WebSecure01.bdf, WebTcpipHttp11.bdf, WebTcpipWebStone01.bdf