Cannot send data multiple times over the same socket

I have established a socket between UR and a python server. Over that socket, I need to send information from the UR to the server, several times throughout the life of the program.
It happens that only the first message sent is received on the server. To send multiple messages from UR, I have to open a socket, send the information and then close the socket, and I have to repeat this for every message I want to send. This way I can receive everything in python.
This behavior seems very strange to me.
Btw I am using the port 30000 on UR and I have a time delay of 0.1 sec between every message sent from UR.

Any help is well apreciated!

can you show us how you make the Programm?

it is no problem to get more thane one msg over one socket, but you need to understand how sockets work.

in my case i send first a msg from the UR to the server, than an msg from server to UR, and this will happend all the time.

0.1 time delay between your computer and the robot? Is this through the same LAN local network?
There is no need to re-open a socket everytime you want to send a new message. Some questions here to help:

  • Is there any other process using the same port? According to UR documentation, it is free, but you could have another process in your computer using it.
  • Which other socket-related features are you using within the loop? To send multiple messages in Python, you only need to re-run methods like send() and recv(). Are you re-running also other methods like bind()?
  • Are you using the same socket-object within the code for different servers? You can only use one socket per communication.

This could also be related to a line-ending problem. The python code may buffer the received characters until it receives a magic line-ending symbol after which it dumps te received data to the receiver program. The data it has gets flushed to the receiver upon socket closing. So you should check the required line-ending strategy user by the UR and the Python program.