Share this page

# lrs_get_last_received_buffer_size

Buffer Functions

Gets the size of the last buffer received.

    int lrs_get_last_received_buffer_size( char *s_desc );

s_desc | A descriptor identifying a socket.

The lrs_get_last_received_buffer_size function gets the size of the last received buffer on the socket s_desc. Note that function returns the length of the binary representation of data.

Use this function instead of lrs_get_last_received_buffer to confirm that data has been received on the socket and you are unconcerned about the content of the data. lrs_get_last_received_buffer_size saves on the expensive operation of copying the data from the winsocket buffer to a user's buffer when this data is not required.

lrs_get_last_received_buffer_size and lrs_get_last_received_buffer 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.

## Return Values

Windows Sockets Return Values

## Parameterization

You cannot use standard parameterization for any arguments in this function.

## Example

In the following example, we check if data was received on a socket using lrs_get_last_received_buffer_size. If not we send an error message.

Copy code

    lrs_receive("socket2", "buf20", LrsLastArg);
    if (lrs_get_last_received_buffer_size("socket2") < 1) {
        lr_error_message("No data received on socket2");
        return -1
    }

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: