Share this page

# lrs_receive

Sockets Functions

Receives data from a datagram or stream socket.

    int lrs_receive( char *s_desc, char *bufindex, [char *flags], LrsLastArg );

s_desc | A descriptor identifying a connected socket.
buffer | A descriptor identifying a buffer. For details on editing the Windows Sockets Buffers, see the Windows Sockets protocol in the VuGen User Guide.
flags | Receive and Send Flags that specify various ways which the call can be made (optional). Use the following format:"Flags=flags"
LrsLastArg | A marker indicating the end of the parameters (used where optional parameters are available).

The lrs_receive function reads the incoming data from a datagram or stream socket. If no incoming data is available at the socket, lrs_receivewaits for data to arrive unless the socket is non-blocking.

VuGen determines the expected size of the buffer from the recorded session. If the buffer size does not match (smaller or larger), lrs_receive rereads the incoming data carried by the socket, until the receive_timeout. By default the receive_timeout is 10 seconds. You can modify the timeout using lrs_set_recv_timeout or lrs_set_recv_timeout2.

Note that the successful completion of a lrs_receive does not indicate that all of the data was successfully received. If the received buffer does not match the expected buffer, VuGen sends a message to the output indicating the mismatch and continues with script execution.

If the socket's type is TCP and the remote side has shut down the connection in an orderly way, lrs_receive finishes without returning any data. If the connection was aborted, lrs_receive returns one of the Windows Sockets error codes.

This function is recorded during a Windows Socket session.

## Return Values

Windows Sockets Return Values

## Parameterization

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

## Example

In the following example, lrs_receive connects to Socket 1 and reads the incoming message from buf 2.

Copy code

    lrs_send("socket1", "buf2", 40, 0);
    lrs_receive("socket1", "buf2", LrsLastArg);
    lrs_close_socket("socket1");

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: