You're reading the documentation for an older, but still supported version (1.33.4).
For information on the latest version, please have a look at 1.33.5.

open_connection

This function connects to the robot controller over TCP/IP. TCP/IP is fixed internally, so it does not need to be specified. When two or more robot controllers are used, change the IP address in the T/P application.

If the controller does not respond, open_connection returns false.

Definition
DRFLEx.h within class CDRFLEx, public section

bool open_connection(string strIpAddr = "192.168.137.100", unsigned int usPort= 12345) { return _open_connection(_rbtCtrl, strIpAddr.c_str(), usPort); };

Parameter

Parameter Name

Data Type

Default Value

Description

strIpAddr

string

“192.168.137.100”

Controller IP address to connect.

usPort

unsigned int

12345

Controller TCP port to connect.

Return

Value

Type

Description

0

int

Error — failed to establish a TCP/IP connection.

1

int

Success — successfully connected to the controller.

Note

When a connection ends (close_connection, loss of connection, or open_connection on an object that is already connected), every callback registered with a set_on_* function is unregistered, except those registered with set_on_disconnected, set_on_monitoring_ctrl_io_ex (with DRCF_VERSION 3, the default), set_on_rt_monitoring_data and set_on_rt_log_alarm, which stay registered. After each successful open_connection, register the other callbacks again and call setup_monitoring_version again. open_connection on a connected object closes the existing connection first and prints “Already connected : <ip>”.

If no data is received from the controller for about 2 seconds, the connection ends and the disconnect callback is called.

When the address passed to open_connection is exactly “127.0.0.1”, task_compliance_ctrl, set_stiffnessx, release_compliance_ctrl, set_desired_force and release_force return true without sending the command to the controller.

The controller accepts at most 10 TCP clients at a time, including the teach pendant. Connect the PC to the controller directly or through a routed network; connections through NAT or port forwarding are rejected during authentication.

Example

bool bConnected = drfl.open_connection("192.168.137.100");
if (bConnected) {
    SYSTEM_VERSION tSysVerion = {};
    drfl.get_system_version(&tSysVerion);
    printf("System version: %s\n", tSysVerion._szController);
}

This example connects the external PC to the robot controller using its IP address. When the connection is successful, it retrieves and prints the controller’s system version information.