lrs_set_recv_timeout2

Example: lrs_set_recv_timeout2Timeout Functions

Sets a timeout for receiving data on a socket after a connection was established.

void lrs_set_recv_timeout2( long sec, long u_sec );
sec The desired timeout in seconds.
u_sec The desired timeout in microseconds (added to the sec parameter)

The lrs_set_recv_timeout2 function sets a timeout limit for receiving data on a socket. When lrs_receive receives the data buffer, it compares its size with the expected data. If the buffer size does not match, it performs additional iterations and rereads the incoming socket data, until the timeout2 limit is reached. You can view these iterations in the full log trace.

This function allows you to customize the behavior of your script for different types of applications:

For example, applications that require a relatively long time for a reply, but once the server replies, the data is received at a quicker rate. In such a case, you can set the connection timeout using lrs_set_recv_timeout to a high limit, and the timeout for subsequent iterations to a lower limit using lrs_set_recv_timeout2. For example, when you perform a query on a database server, it may take time for the server to process your request and return data. However, once the server begins to send data, it continues sending with almost no delay. Therefore, the receive timeout for the remainder of the data, timeout2, should be decreased.

Other applications connect to the server quickly, but the data transfer requires a longer period of time, such as in a heavily loaded network. In this case, you set lrs_set_recv_timeout to a low value and timeout2 to a higher value.

Return Values

This function has no return value.

Parameterization

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