1.2.1.13.44 TCPIP_HTTP_NET_DynamicWrite Function

C

bool TCPIP_HTTP_NET_DynamicWrite(
    const TCPIP_HTTP_DYN_VAR_DCPT* varDcpt, 
    const void * buffer, 
    uint16_t size, 
    bool needAck
);

Description

This function takes a buffer and sends it over the HTTP connection as part of the HTTP dynamic variable processing.

Preconditions

varDcpt - a valid dynamic variable descriptor.

Parameters

ParametersDescription
varDcptDynamic variable descriptor as passed in the template_DynPrint() function.
bufferThe pointer to the persistent buffer to be written to the HTTP connection as part of this dynamic variable callback.
sizeThe number of bytes to be written.
needAckIf true, once the buffer is processed internally, template_DynAcknowledge() will be called.

Returns

  • True - Data buffer has been queued for output.

  • False - An invalid buffer was provided or the buffer could not be queued because of lack of resources (descriptors).

Remarks

The buffer passed in by the user with this call is queued internally using an available dynamic variable buffer descriptor. That means that the buffer has to be persistent. Once the buffer is processed and sent to output, the dynamicAck callback will be called, to inform the user that the corresponding buffer can be reused/freed.

When multiple connections output their dynamic content concurrently, the HTTP may run out of dynamic variable buffer descriptors that are used in queuing the requests and the call may fail. If the call failed, because the buffer could not be queued, it may be retried by returning TCPIP_HTTP_DYN_PRING_RES_AGAIN() in the template_DynPrint() callback.

If sequential write calls are done from within the same template_dynPrint() call, the HTTP module will try to append the new dynamic data to the existent one.

The number of internal HTTP dynamic variable buffer descriptors is contolled by TCPIP_HTTP_NET_DYNVAR_DESCRIPTORS_NUMBER(). It can be obtained at run-time using the TCPIP_HTTP_NET_ConnectionDynamicDescriptors() function.