Hi Sepehr,
Have you taken a look to the method’s documentation? From what I could find on the internet, this method is to be used after the socket was openned. Socket openning can be done with socket_open method, which returns a boolean indicating wether it has succeded or not.
Do you check the return value of your socket opening?
For more information please follow post about "Ethernet socket communication via URScript - 15678" :)
Regards.
Paul
Sepehr
Yes, that's why I decided to post it here to check if someone else had the same issue before or not!PaulGWF said:@Sepehr
it seems quite odd that the socket_open returns true when connecting to a host that is unreachable.
This might seem very basic to you but are you sure that you are using the correct host address and port?
I validated that the port and IP are correct for openning the socket.
I am still working on this issue! Will keep you updated if I found an answer to this!
Sepehr
Thanks for your help.bcastets said:Maybe can use modbus register of the robot and a stread to check if the connection is correctly running.
- Set a modbus register variable by default the value will be 0 (not connected)
- Make stread on your PC which periodically write a 1 in the modbus register of the robot.
- Make a stread on the robot which:If the tread frequency on the robot is twice less than the tread frequency of the PC stread, it should work.
- return the modbus register variable to 0 if it is a 1.
- display a disconnection message if the variable is at 0
I hope it helps,
I will try your solution in the near future. I decided not to continue using this validation in my program for now.
Hello all,
I am trying to create a socket through a UR script (socket_open) on a UR10 and then read/send data from/to PC. (read data to move the robot and send a random string to make sure the PC is still connected)
The problem is that the command "isConnected = socket_send_string(\"test\")\n" is always successful (always return true!) even if I disconnect the cable between the robot controller and PC!
Is there a way that I can detect the connection problem between robot and pc? Or am I doing something wrong here?
Thanks in advance for help.