WebTcpipRecvProto Function


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.

Include file



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;

Return value

  • 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.

Specify any combination of following flags (optional):

  • TCP_FLAG_LITTLE_ENDIAN. Specifies the byte order of the packet-length section. Little-endian means, that the most significant byte is at the end. Big-endian (default) means, that the most significant byte is at the front of the packet-length section.

  • TCP_FLAG_INCLUDE_PROTO. Specify this flag to signal, that the bytes of the protocol header (ending with the specified packet-length section) are included in the calculated packet-length. If this flag is not set, the receive operation of the calculated packet-length starts after the protocol header.

  • TCP_FLAG_TextProto. Specify this option if the length specification is provided as a string (readable value). By default this value will be interpreted as a decimal number. Use TCP_FLAG_TextProtoHex for a hexadecimal number or TCP_FLAG_TextProtoOct for an octal representation.

  • TCP_FLAG_TextProtoNumberOnly. Specify this flag in combination with TCP_FLAG_TextProto if the length specification consists of an unknown number of digits and if the header is not included in the specified length (TCP_FLAG_INCLUDE_PROTO must not be specified). If specified the body starts after the last digit of the length specification.

  • TCP_FLAG_TextProtoHex. Use this flag in combination with the TCP_FLAG_TextProto option to interpret the length specification as a hexadecimal number.

  • TCP_FLAG_TextProtoOct. Use this flag in combination with the TCP_FLAG_TextProto option to interpret the length specification as an octal number.

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.

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).


  transaction TWeb
    hWeb      : number;
    sHdr      : string(2000);
    sSize     : string(20);
    nReceived : number;
    WebTcpipConnect(hWeb, "lab3", 80);
    WebTcpipSend(hWeb, "Start\r\n");
    StrSearchDelimited(sSize, STRING_COMPLETE, sHdr,
                       "Age: ", 1, "\r\n",
                       1, STR_SEARCH_FIRST);
    WebTcpipShutdown(hWeb, WEB_SHUTDOWN_RESET);
  end TWeb;