close_connection

This function disconnects the robot controller from the external PC. It safely terminates the established TCP/IP communication session.

Definition
DRFLEx.h within class CDRFLEx, public section

bool close_connection() { return _close_connection(_rbtCtrl); };

Parameter
None

Return

Value

Type

Description

1

int

Success — robot controller disconnected successfully.

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>”.

After the connection has ended, call only open_connection.

Example

drfl.close_connection();

This example safely closes the TCP/IP connection with the robot controller, ensuring all communication sessions are properly terminated.