Share this page

# lrs_create_socket

Example: lrs_create_socket | Sockets Functions

Initializes a socket.

    int lrs_create_socket( char *s_desc, char *type, [ char* LocalHost,] [char* peer,] [char *backlog,] LrsLastArg );

s_desc | A descriptor identifying an unbound socket.
type | One of the available Socket Types
LocalHost | The local host and port number of the socket for binding, using the form: "LocalHost= host_name/port_number" (optional)
peer | The name of the peer remote host and its port number, to which the socket will be connected, using the form: "RemoteHost=host_name/port_number" (optional)
backlog | The maximum length to which the queue of pending connections may grow, using the form: "Backlog=number" (optional)
LrsLastArg | A marker indicating the end of the parameters (used where optional parameters are available).

The lrs_create_socket function initializes a socket. It performs a socket command to open the new socket. If a LocalHost parameter is provided, it performs a bind command to name the socket. If a peer parameter is provided, it performs a connect to establish a connection with the peer. If a backlog parameter is provided, it performs a listen command for the socket.

Note that for the LocalHostparameter you can specify a host name before the port number (for example "LocalPort=steel:1234"). This is useful for machines with multiple IP addresses. You can also specify a host by it's IP address (for example "LocalPort=122.34.15.7:1234").

This function is recorded during a Windows Socket session for either a client or a server. If a client session is recorded, lrs_create_socket is generated with peer and port arguments. If a server session is recorded, lrs_create_socket is generated with port and backlog arguments.

## Return Values

Windows Sockets Return Values

## Parameterization

The LocalHost, peer, and backlog arguments can be parameterized.

Tips to improve your search results... VuGen Function Reference Version 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: