Create a TCP-Connection with a custom Port with a URCap

Hello All,

We are currently developing an URCap that should communicate with a PLC via a TCP/IP connection.

The goal is to display PLC-messages and error messages directly in the robot’s Installation tab in a dedicated user interface.

To achieve this, we implemented a TCP server (port 31003) on the robot side, which opens automatically when the URCap starts.

This server is started via a small systemd service and a netcat listener script generated from the URCap’s Java contribution class.

At first, everything works correctly:

• The port is opened successfully (LISTEN status confirmed via netstat – tlnp),

• The PLC can connect and exchange messages with the URCap.

After a few minutes, however, the port closes automatically, even though the systemd service is initially active.

We are looking for answers for the following questions:

1. Is there a supported method to keep a custom TCP port permanently open for communication with a PLC?

2. Are there any URCap API functions or secure interfaces (other than RTDE or the dashboard/secondary ports) that allow a persistent inbound TCP connection?

3. If not, is there a way to whitelist a custom systemd service so that it remains active after a reboot?

Thanks a lot in advance!

Could be an issue with Keep-Alive on the TCP socket. Maybe there is a setting when you open the client socket to set keep-alive.