lrs_set_socket_options

Sockets Functions

Sets a socket option.

int lrs_set_socket_options( char *s_desc, int option, char *option_value );
s_desc A descriptor identifying a socket.
option A socket option. Currently, the only available option is LRS_NO_DELAY.
option_value The option value or type. Currently, the available values are TRUE or FALSE. Setting the value to TRUE enables the LRS_NO_DELAY option.

The lrs_set_socket_options function sets an option for the specified buffer.

Under normal circumstances, TCP sends data when it is presented. If outstanding data has not yet been acknowledged, it gathers small amounts of output and sends it in a single packet once an acknowledgement is received. For several client types, such as window systems that send a stream of mouse events, this gathering of data into packets may cause significant delays.

Therefore, TCP provides a Boolean option, TCP_NODELAY to defeat this algorithm and prevent the delay. The LRS equivalent of this option is LRS_NO_DELAY.

Note: This function may only be used with TCP sockets.

Return Values

Windows Sockets Return Values

Parameterization

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

Example

In the following example, lrs_set_socket_options sets the LRS_NO_DELAY option for socket1.

int opt_value;
lrs_create_socket("socket1", "TCP", "RemoteHost=tears.abc.co.il:23", LrsLastArg);
/* Since opt_value was declared as an int type, it must be cast. */
lrs_set_socket_options("socket1", LRS_NO_DELAY, (char*)(&opt_value)); 
lrs_send("socket1", "buf2", LrsLastArg);