Windows Sockets Vuser Functions (LRS) > Alphabetical List of Functions > lrs_receive

lrs_receive

Example: 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 How to View and Modify Windows Sockets Buffers under 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.