Open topic with navigation
|Example: lrs_get_last_received_buffer||Buffer Functions|
Gets the last buffer received and its size.
int lrs_get_last_received_buffer( char *s_desc, char **data, int *size );
|s_desc||A descriptor identifying a socket.|
|data||A pointer to the buffer containing the data.|
|size||A pointer to the size (in bytes) of the data.|
The lrs_get_last_received_buffer function gets the last received buffer on the socket and its size. Note that function returns the length of the binary representation of data. The data buffer is not NULL terminated.
Note that memory is automatically allocated for the buffer, but you must manually free the memory after using this function with lrs_free_buffer.
This function is not recorded during a WinSock session—you manually insert it into your script. In addition, you must declare variables to store the buffer and its size, before calling lrs_get_last_received_buffer. Declare a character pointer for the data parameter, and an integer for the size parameter.
lrs_get_last_received_buffer and lrs_get_last_received_buffer_size should always follow one of the set of "receive" functions which write received data to a winsocket buffer. The "receive" functions are lrs_receive, lrs_receive_ex and lrs_length_receive.
You cannot use standard parameterization for any arguments in this function.