.varbuffrq Method

Function:

For the selected socket (selection is made through sock.num), pre-requests numpages number of buffer pages (1 page = 256 bytes) for the VAR buffer of the socket.

Syntax:

sock.varbuffrq(numpages as {byte | word}) as {byte | word}

Returns:

Actual number of pages that can be allocated.

See Also:

sock.varlen


Part

Description

numpages

Requested numbers of buffer pages to allocate. For the time being, the maximum allowed value is 255.


Details

The VAR buffer stores the HTTP request string. The socket is unable to process HTTP requests if its VAR buffer has 0 capacity.

The actual allocation happens when the sys.buffalloc method is used. Unlike the TX or RX buffers, on 16-bit platforms there is no property to read out actual VAR buffer capacity in bytes. This capacity can be calculated as num_pages * 256 - X (or = 0 when num_pages = 0), where "num_pages" is the number of buffer pages that was GRANTED through sock.varbuffrq. The "- X" is because a number of bytes is needed for internal buffer variables. X = 17 bytes on 16-bit platforms and 33 bytes on 32-bit platforms. Platform type is specified in your platform documentation.

Buffer allocation will not work if the socket to which this buffer belongs is not idle (sock.statesimple is not at 0 — PL_SSTS_CLOSED) at the time when sys.buffalloc executes. You can only change buffer sizes of sockets that are idle.

The VAR buffer is only required when you plan to use this socket in the HTTP mode — see the sock.httpmode and sock.httpportlist properties.


Older devices had smaller RAM sizes, so the numpages argument and the value returned by the method were of the byte type. The maximum possible number of pages, therefore, could not exceed 255. On newer devices with larger RAM capacities, this method takes and returns word values. Inspect the method's declaration on the platform you are using to make sure you know the data type it employs.

A warning note icon.For the time being, the maximum number of pages that can be allocated for the RX buffer is still limited to 255. This limitation will be removed in future releases of TiOS.


.varbuffrq Method

Details