Share this page

# lrvtc_connect

Generates a connection descriptor.

## C Language

    VTCERR2 lrvtc_connect ( char*servername, int portnumber, int options );

## C# Language

    void vts.connect ( string servername, int portnumber, int options );

## Java Language

    int Lrvtc.connect ( string servername, int portnumber, int options );

Global Functions

## Arguments

Name | Comments
--- | ---
servername | The name or IP address of the VTS server host.
portnumber | The port the server is listening on.
options | If the keep alive option is passed, the HTTP connection is kept open after the function returns. If no options are passed, the connection is closed when the function returns. One of: 0 - No options VTOPT_KEEP_ALIVE - Keep connection alive (C language) LoadRunner.ConnectionOptions.KeepAlive - Keep connection alive (C# language) Constants.VTOPT_KEEP_ALIVE - Keep connection alive (Java language)

The lrvtc_connect function creates a connection to the server.

If a connection already exists, it is automatically disconnected, and cleared.

## Return Values

C Language: Returns zero on success or one of the Error Codes.

C# Language: No return value.

Java Language: Returns zero on success or one of the Error Codes.

## Parameterization

All string input arguments can be passed using standard parameterization.

## C Language Example

Copy code

    char  *VtsServer = "myVTSserver";
    int   nPort = 8888;
    int   rc;

    vuser_init()
    {
        rc = lrvtc_connect(VtsServer,nPort,VTOPT_KEEP_ALIVE);
        lr_log_message("Connect result rc=%d\n", rc);
        return 0;
    }

## C# Language Example

.NET Single Connection Example

## Java Language Example

Java Single Connection Example

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: