Retrieves a calculated amount of data from the remote host. The protocol specification parameters define the performed calculation. If for example every tcp packet contains its length specification at a fixed position (e.g. first two bytes) these packets can be easily received with the WebTcpipRecvProto function.
Only the first nMaxData bytes are stored into the buffer sData. If sData is set to NULL, internal buffers are used for retrieval.
WebAPI.bdh
WebTcpipRecvProto( 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): 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). |
dcltrans transaction TWeb var hWeb : number; sHdr : string(2000); sSize : string(20); nReceived : number; begin WebTcpipConnect(hWeb, "lab3", 80); WebTcpipSend(hWeb, "Start\r\n"); WebTcpipRecvProto(hWeb, 0, 2, TCP_FLAG_INCLUDE_PROTO | TCP_FLAG_LITTLE_ENDIAN, sHdr, STRING_COMPLETE, nReceived); StrSearchDelimited(sSize, STRING_COMPLETE, sHdr, "Age: ", 1, "\r\n", 1, STR_SEARCH_FIRST); WebTcpipShutdown(hWeb, WEB_SHUTDOWN_RESET); end TWeb;