WebTelnetRecvRecordsUntilClose Function

Action

Receives data (packets terminated by IAC EOR) from a given connection until the Telnet connection is closed. This function is only valid on open Telnet connections.

Include file

WebAPI.bdh

Syntax

WebTelnetRecvRecordsUntilClose(    in  hWeb  : number,
                                   out sRecv : string optional ): boolean;

Return value

  • true if the operation succeeded

  • false otherwise

Parameter Description
hWeb Valid handle to a Web connection created by WebTcpipConnect and set to Telnet mode using WebTcpipSetTelnetMode.
sRecv Optional string variable where all received binary data is to be placed until connection is closed.

Example

dcltrans
  transaction TInit
  begin
    StrSetHostCP(1047); // 1047
 (IBM EBCDIC - Latin-1/Open System)
  end TInit;

  transaction   TMain
  var
    hWeb0     : number;
    sBuffer   : string;
    sBoundary : string;
    nOption   : number;
  begin
    WebTcpipConnect(hWeb0, "My.TelnetHost.IP", WEB_PORT_TELNET);
    WebTcpipSetTelnetMode(hWeb0, TERMINAL_TYPE_3270, 80, 24, true,
      TELNET_MODEOPT_RFC_1576 | TELNET_MODEOPT_AUTO_RECV | TELNET_MODEOPT_3270E_AUTO_REPLY);
    
    WebTelnetRecvCommand(hWeb0, TELNET_CMD_DO, TELNET_OPT_TN3270E);
    WebTelnetSendCommand(hWeb0, TELNET_CMD_WILL, TELNET_OPT_TN3270E);
    WebTelnetRecvSubNegotiation(hWeb0, TELNET_OPT_TN3270E);
    WebTelnetSendSubNegotiation(hWeb0, TELNET_OPT_TN3270E, TN3270E_CMD_DEVICE_TYPE + TN3270E_CMD_REQUEST + "IBM-3278-2-E");
    WebTelnetRecvSubNegotiation(hWeb0, TELNET_OPT_TN3270E);
    WebTelnetSendSubNegotiation(hWeb0, TELNET_OPT_TN3270E, TN3270E_CMD_FUNCTIONS + TN3270E_CMD_REQUEST + TN3270E_FUNC_BIND_IMAGE
      + TN3270E_FUNC_RESPONSES + TN3270E_FUNC_SYSREQ);
    WebTelnetRecvSubNegotiation(hWeb0, TELNET_OPT_TN3270E);
    WebTelnetScreenRecvRecordsUntilStatus(hWeb0, "Keyboard locked", "False");
    WebTelnetRecvRecord(hWeb0);
    WebTelnetRecvRecord(hWeb0);
    WebTelnetSendRecord(hWeb0, "\h00000000007DD4D2"); // ·····}ÔÒ
    WebTelnetScreenRecvRecordsUntilStatus(hWeb0, "Keyboard locked", "False");
    WebTelnetSendRecord(hWeb0, "\h00000000017D4040"); // ·····}@@
    WebTelnetScreenRecvRecordsUntilCursor(hWeb0, 57, 24);
    WebTelnetSendRecord(hWeb0, "\h00000000027D5DE9115DE8" + StrToHostCP("1___________________"));
    WebTelnetScreenRecvRecordsUntilStatus(hWeb0, "Keyboard locked", "False");
    WebTelnetSendRecord(hWeb0, "\h00000000037D5D6C"); // ·····}]l
    WebTelnetScreenRecvRecordsUntilStatus(hWeb0, "Keyboard locked", "False");
    WebTelnetSendRecord(hWeb0, "\h00000000047D5DE9115DE8" + StrToHostCP("3___________________"));
    WebTelnetScreenRecvRecordsUntilStatus(hWeb0, "Keyboard locked", "False");
    WebTelnetSendRecord(hWeb0, "\h00000000057D50F311C77E" + StrToHostCP("p") + "\h11506E" + StrToHostCP(
      "hello_____________________________________"));

    WebTelnetScreenRecvRecordsUntilStatus(hWeb0, "Keyboard locked", "False");
    WebTelnetSendRecord(hWeb0, "\h0000000006F35D6A"); // ·····ó]j
    WebTelnetScreenRecvRecordsUntilStatus(hWeb0, "Keyboard locked", "False");
    WebTelnetSendRecord(hWeb0, "\h0000000007F3C77E"); // ·····óÇ~
    WebTelnetScreenRecvRecordsUntilStatus(hWeb0, "Keyboard locked", "False");
    WebTelnetSendRecord(hWeb0, "\h0000000008F35DE8"); // ·····ó]è
    WebTelnetScreenRecvRecordsUntilStatus(hWeb0, "Keyboard locked", "False");
    WebTelnetSendRecord(hWeb0, "\h0000000009F35DE8"); // ·····ó]è
    WebTelnetScreenRecvRecordsUntilStatus(hWeb0, "Keyboard locked", "False");
    WebTelnetRecvRecord(hWeb0);
    WebTelnetRecvRecord(hWeb0);
    WebTelnetSendRecord(hWeb0, "\h000000000AF3D4D2"); // ·····óÔÒ
    WebTelnetRecvRecordsUntilClose(hWeb0);

    WebTcpipShutdown(hWeb0)
  end TMain;