Utility Functions and C Language Reference > Virtual Table Server Functions (VTS) for C, C#, and Java > Virtual Table Server (VTS) Functions for Single Connection > Alphabetical Listing > lrvtc_connect

lrvtc_connect

Generates a connection descriptor.

C Language

long 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

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