Like the WebTcpipRecvProto function, but with the additional possibility to verify a fixed portion of the tcp packet (by specifying its starting position and length), and two additional parameters to define the performed packet-length calculation (multiplication and addition). If the verification fails an error is raised.
WebAPI.bdh
WebTcpipRecvProtoEx( in hWeb : number, in nProtoStart : number, in nProtoLength : number, in nOption : number optional, out sData : string optional, in nMaxData : number optional, out nReceived : number optional, in sVerify : string optional, in nVerifyStart : number optional, in nVerifyLength : number optional, in nMultiply : number optional, in nAdd : number optional ): boolean;
true if the receive operation succeeded
false otherwise
Parameter | Description |
---|---|
hWeb | Valid handle to a Web connection that was created by WebTcpipConnect. |
nProtoStart | Starting byte of the packet-length specification. |
nProtoLength | Length of the packet-length specification. |
nOption |
Specify any combination of following flags (optional):
|
sData |
Buffer to store the received data (optional). This field also can be set to NULL (default) 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 effect when sData is set to NULL. If this parameter is omitted only internal buffers are used. |
nReceived | Parameter that receives the actual amount of data received from the server (optional). |
sVerify | Binary pattern to verify (optional). If this parameter is omitted no verification is performed. |
nVerifyStart | Starting position of the pattern verification (optional). If this parameter is omitted the verification starts at the beginning. |
nVerifyLength | Length of the verification pattern (optional). If this parameter is omitted no verification is performed. |
nMultiply | The parsed packet-length (specified by the nProtoStart, nProtoLength and bLittleEndian parameters) is multiplied by nMultiply and finally nSum is added (optional). If this parameter is omitted no multiplication is performed. |
nAdd | The parsed packet-length (specified by the nProtoStart, nProtoLength and bLittleEndian parameters) is multiplied by nMultiply and finally nAdd is added (optional). If this parameter is omitted no addition is performed. |
dcltrans transaction TWeb var hWeb : number; sHdr : string(2000); sSize : string(20); nReceived : number; begin WebTcpipConnect(hWeb, "lab3", 80); WebTcpipSend(hWeb, "Start\r\n"); WebTcpipRecvProtoEx(hWeb, 0, 2, TCP_FLAG_INCLUDE_PROTO | TCP_FLAG_LITTLE_ENDIAN, sHdr, STRING_COMPLETE, nReceived, "WIDECHARS", 2, 9, 2, 18); StrSearchDelimited(sSize, STRING_COMPLETE, sHdr, "Age: ", 1, "\r\n", 1, STR_SEARCH_FIRST); WebTcpipShutdown(hWeb, WEB_SHUTDOWN_RESET); end TWeb;