Enabling ports#

In some applications, it is advantageous to access the same scene using different scripts. You can do it by enabling more ports.

../../_images/ports.png

CoppeliaSim has the port 19997 enabled by default to start the remote API server. The ports are defined in remoteApiConnections.txt, which is located in your CoppeliaSim installation.

This is the default content of file remoteApiConnections.txt:

 1// This file defines all the continuous remote API server services (started at remote API plugin initialization, i.e. CoppeliaSim start-up)
 2//
 3// Each remote API server service requires following 3 entries:
 4//
 5// portIndex@_port = xxxx               // where xxxx is the desired port number (below 19997 are preferred for server services starting at CoppeliaSim start-up)
 6// portIndex@_debug = xxxx              // where xxxx is true or false
 7// portIndex@_syncSimTrigger = xxxx     // where xxxx is true or false. When true, then the service will be pre-enabled for synchronous operation.
 8//
 9// In above strings, @ can be any number starting with 1. If more than one server service is required, then numbers need to be consecutive and starting with 1
10
11// Let's start a continuous remote API server service on port 19997:
12portIndex1_port             = 19997
13portIndex1_debug            = false
14portIndex1_syncSimTrigger   = true

The definition of a new port requires three entries, namely portIndex@_port, portIndex@_debug, and portIndex@_syncSimTrigger. (Check the definition of the port 19997 in lines 12-14).

For instance, to enable the port 19998, we need to add the following entries in remoteApiConnections.txt:

portIndex2_port             = 19998
portIndex2_debug            = false
portIndex2_syncSimTrigger   = true

The final remoteApiConnections.txt should look like this:

// This file defines all the continuous remote API server services (started at remote API plugin initialization, i.e. CoppeliaSim start-up)
//
// Each remote API server service requires following 3 entries:
//
// portIndex@_port = xxxx               // where xxxx is the desired port number (below 19997 are preferred for server services starting at CoppeliaSim start-up)
// portIndex@_debug = xxxx              // where xxxx is true or false
// portIndex@_syncSimTrigger = xxxx     // where xxxx is true or false. When true, then the service will be pre-enabled for synchronous operation.
//
// In above strings, @ can be any number starting with 1. If more than one server service is required, then numbers need to be consecutive and starting with 1

// Let's start a continuous remote API server service on port 19997:
portIndex1_port             = 19997
portIndex1_debug            = false
portIndex1_syncSimTrigger   = true
portIndex2_port             = 19998
portIndex2_debug            = false
portIndex2_syncSimTrigger   = true

Note

You’ll need to restart CoppeliaSim for the remoteApiConnections.txt modifications to take effect.

See also

Enabling ports 20010, 20011, 20012, 20013, and 20020. AISciencePlatform/aisp_coppeliasim_scenes