Share this page

# lrs_set_socket_handler

Sockets Functions

Sets a socket handler for the specified socket.

    int lrs_set_socket_handler( char *s_desc, int handler );

s_desc | A descriptor identifying the socket.
handler | A socket handler.

The lrs_set_socket_handler function sets a socket handler for the specified socket.

This function is not recorded during a WinSock session—you manually insert it into your script.

## 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_handler switches the socket handlers of socket0 and socket1.

Copy code

    int socket0_handler=0, socket1_handler=0;
    lrs_create_socket("socket0", "UDP", LrsLastArg);
    socket0_handler=lrs_get_socket_handler("socket0");
    lrs_create_socket("socket1", "UDP", "LocalHost=0", "RemoteHost=localhost:1496", LrsLastArg);
    socket1_handler=lrs_get_socket_handler("socket1");
    lrs_set_socket_handler("socket1", socket0_handler);
    lrs_set_socket_handler("socket0", socket1_handler);
    return 0;

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: