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


servername The name or IP address of the VTS server host.
portnumberThe port the server is listening on.

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.


All string input arguments can be passed using standard parameterization.

C Language Example

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

    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