Second remoteApi client gets rejected

Typically: "How do I... ", "How can I... " questions
Post Reply
baxter
Posts: 4
Joined: 03 Apr 2017, 17:18

Second remoteApi client gets rejected

Post by baxter »

Hi all,

On Linux x64 I am trying to connect several Python processes to V-Rep.
The first successfully connects but the other ones are rejected with 2 errors: No value + Timeout.

Even the simpleTest.py sample fails to connect twice. Example:

Code: Select all

# TERMINAL 1
$ python simpleTest.py
Program started
Connected to remote API server
('Number of objects in the scene: ', 15)
('Mouse position x: ', 1161)
[... and so on...]

Code: Select all

# MEANWHILE, ON TERMINAL 2
$ python simpleTest.py
Program started
Connected to remote API server
('Remote API function call returned with error code: ', 3)
Program ended
I thought it could be due to MAX_EXT_API_CONNECTIONS not set to 255, but recompiling shows that this is the default value:

Code: Select all

V-REP_PRO_EDU_V3_3_2_64_Linux/programming/remoteApiBindings/lib$ make
gcc -I../../include -I../../remoteApi -Wall -DNON_MATLAB_PARSING -DMAX_EXT_API_CONNECTIONS=255 -fPIC -D__linux -c ../../remoteApi/extApi.c -o extApi.o
../../remoteApi/extApi.c: In function ‘_communicationThread’:
../../remoteApi/extApi.c:1813:16: warning: variable ‘crc’ set but not used [-Wunused-but-set-variable]
     simxUShort crc,pureDataOffset0;
                ^
gcc -I../../include -I../../remoteApi -Wall -DNON_MATLAB_PARSING -DMAX_EXT_API_CONNECTIONS=255 -fPIC -D__linux -c ../../remoteApi/extApiPlatform.c -o extApiPlatform.o
gcc extApi.o extApiPlatform.o -o lib/remoteApi.so -lpthread -ldl -I../../include -I../../remoteApi -Wall -DNON_MATLAB_PARSING -DMAX_EXT_API_CONNECTIONS=255 -fPIC -D__linux -lpthread -ldl -shared
What else could it be?

coppelia
Site Admin
Posts: 10336
Joined: 14 Dec 2012, 00:25

Re: Second remoteApi client gets rejected

Post by coppelia »

Hello,

you need to make sure that your second client connects on a different remote API port. Is this the case?
This would also mean that on the V-REP side, you need to start two remote API server services on two different ports, where the clients will be able to connect to.

Cheers

baxter
Posts: 4
Joined: 03 Apr 2017, 17:18

Re: Second remoteApi client gets rejected

Post by baxter »

Thanks for this reply coppelia, since a netstat returned only one open port I assumed it was accepting several connections on this single port (which would be more handy by the way). How do you activate several remote API server services?

coppelia
Site Admin
Posts: 10336
Joined: 14 Dec 2012, 00:25

Re: Second remoteApi client gets rejected

Post by coppelia »

When you start V-REP, then it will start remote API server services as described in the file remoteApiConnections.txt (by default a single service on port 19997 will be started).

But you can also start/stop the remote API server services as you need them, on the go, with following instruction from a script:

Code: Select all

simExtRemoteApiStart(portNumber)
You can read more here.

Cheers

baxter
Posts: 4
Joined: 03 Apr 2017, 17:18

Re: Second remoteApi client gets rejected

Post by baxter »

OK, it works, thanks.
I would suggest to store those parameters in the ttt also, overriding the txt file if present.

coppelia
Site Admin
Posts: 10336
Joined: 14 Dec 2012, 00:25

Re: Second remoteApi client gets rejected

Post by coppelia »

That doesn't make sense. If you need to create specific remote API server services, then you should create them inside of your scene: inside of a child script (active only during simulation), or inside of a customization script (active as long as the object is present in the scene).

Cheers

Post Reply