Notes a Telnet command to be verified as received on next sending operation in a Telnet connection. This asynchronous function helps building more robust scripts because some Telnet servers mix Telnet command sequences with regular output data. The received data itself will be prepended to data in the order it was received in the next subsequently received function call.
WebAPI.bdh
WebTelnetSyncCommand( in hWeb : number, in iCmd : number, in iOpt : number optional ) : boolean;
true if the operation was successful
false otherwise
Parameter | Description |
---|---|
hWeb | Valid handle to a Web connection created by WebTcpipConnect and set to Telnet mode using WebTcpipSetTelnetMode. The connection must be in “Sync-Mode” (set option TELNET_MODEOPT_SYNC). |
iCmd | Telnet command to be received from the server (optional). If omitted or set -1 then no verification will be performed. See constants in WebTelnetSendCommand for valid values. |
iOpt | Telnet option for WILL/WONT/DO/DONT and SB Telnet commands (optional). See constants in WebTelnetSendCommand for valid values. If omitted or set to -1 no verification will be performed. |
dcltrans transaction TInit begin StrSetHostCP(28591); // 28591 (ISO 8859-1 Latin I) 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_ANSI, 80, 24, true, TELNET_MODEOPT_RFC_1576 | TELNET_MODEOPT_SYNC); WebTelnetSetTerminalConfigString(hWeb0, "AutoWrap=false 8Bit=false Tab=9*"); WebTelnetSyncCommand(hWeb0, TELNET_CMD_DO, TELNET_OPT_TerminalType); WebTelnetSyncCommand(hWeb0, TELNET_CMD_DO, TELNET_OPT_NegotiateWindowSize); WebTelnetSyncCommand(hWeb0, TELNET_CMD_DO, TELNET_OPT_RemoteFlowControl); WebTelnetSyncCommand(hWeb0, TELNET_CMD_DO, TELNET_OPT_SendLocation); WebTelnetSyncCommand(hWeb0, TELNET_CMD_WILL, TELNET_OPT_Echo); WebTelnetSyncCommand(hWeb0, TELNET_CMD_WILL, TELNET_OPT_SuppressGoAhead); WebTelnetSyncCommand(hWeb0, TELNET_CMD_DO, TELNET_OPT_TerminalSpeed); WebTelnetSyncCommand(hWeb0, TELNET_CMD_DO, TELNET_OPT_XDisplayLocation); // commands above are verified here WebTelnetSendCommand(hWeb0, TELNET_CMD_WILL, TELNET_OPT_TerminalType); WebTelnetSendCommand(hWeb0, TELNET_CMD_WILL, TELNET_OPT_NegotiateWindowSize); WebTelnetSendSubNegotiation(hWeb0, TELNET_OPT_NegotiateWindowSize, "\h00500018"); //•P•• WebTelnetSendCommand(hWeb0, TELNET_CMD_WONT, TELNET_OPT_RemoteFlowControl); WebTelnetSendCommand(hWeb0, TELNET_CMD_WONT, TELNET_OPT_SendLocation); WebTelnetSendCommand(hWeb0, TELNET_CMD_DO, TELNET_OPT_Echo); WebTelnetSendCommand(hWeb0, TELNET_CMD_DO, TELNET_OPT_SuppressGoAhead); WebTelnetSendCommand(hWeb0, TELNET_CMD_WONT, TELNET_OPT_TerminalSpeed); WebTelnetSendCommand(hWeb0, TELNET_CMD_WONT, TELNET_OPT_XDisplayLocation); WebTelnetSyncSubNegotiation(hWeb0, TELNET_OPT_TerminalType); WebTelnetSyncCommand(hWeb0, TELNET_CMD_DONT, TELNET_OPT_RemoteFlowControl); WebTelnetSyncCommand(hWeb0, TELNET_CMD_DONT, TELNET_OPT_SendLocation); WebTelnetSyncCommand(hWeb0, TELNET_CMD_DONT, TELNET_OPT_TerminalSpeed); WebTelnetSyncCommand(hWeb0, TELNET_CMD_DONT, TELNET_OPT_XDisplayLocation); // sync commands above are verified here WebTelnetSendTerminalType(hWeb0, "vt100"); // sync commands above are received here WebTcpipRecvClose(hWeb0, NULL); WebTcpipShutdown(hWeb0); end TMain;