Share this page

# pcoip_connect_desktop

Connects to the remote desktop using its identifier.

## C Language

int pcoip_connect_desktop(const char* desktop_id);

Example | Teradici PCoIP Protocol Functions

## Arguments

Name | Comments
--- | ---
desktop_id | The ID of the remote desktop.

## General Information

pcoip_connect_desktop connects to the remote desktop using the desktop ID, in contrast to pcoip_connect which needs the IP address and port of the remote desktop.

Before calling pcoip_connect_desktop, set the credentials with pcoip_set_auth.

## Return Values

E_OK |
E_ALREADY_CONNECTED | Do not call this function after the connection is established.
E_NOT_CONNECTED | Action cannot be performed. There is no connection to the remote server.
E_OUT_OF_TIME | Function timed out.
E_ILLEGAL_PARAMETER | Illegal parameter found.
E_INTERNAL | Internal error found.

## Parameterization

The desktop_id argument can be parameterized.

## Example

This example shows a connection and disconnection.

    int nIteration = 0;

    char* sIteration = lr_eval_string("{IterNum}");

    if(sIteration != NULL)
    	nIteration = atoi(sIteration);

    pcoip_set_broker_address("broker.pcoip.com", "443");

    pcoip_set_auth("johndoe", "my_domain", lr_unmask("12a3456789b009cde87ffedc"));

    // Connect remote desktop using its DesktopID each even iteration,
    // and using its IP address/port each odd iteration
    if( (nIteration % 2) == 0 )
    	pcoip_connect_desktop("cn=desktops,ou=apps,dc=vdi,dc=vmware,dc=int");
    else
    	pcoip_connect("10.10.14.22", "10.10.14.22", "", "4172");

    pcoip_set_display(800, 600);

    lr_think_time(5);
    pcoip_mouse_click(626, 13, LEFT_BUTTON, 0, "snapshot2");

    pcoip_disconnect();

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