Command "socket_open" never works

I am trying to use the command “socked_open” but it never works, I use this program on the robot UR3.

BeforeStart
open≔socket_open(“127.0.0.1”,21)
Loop open≟ False
open≔socket_open(“127.0.0.1”,21)
targetPos≔p[0,0,0,0,0,0]
counter≔0

And the variable “open” never go to True, I used different IP address for the server and different ports but It never works.

I do not know if it some configuration that I need to do previous or what is the problem. the communication with the PC works because I use the command “ping with the IP address” on the “cmd” and everything works but the “socked_open” does not works

Someone can help me!

Are you running a server on the robot at port 21? The IP address you are using is the local host for the robot, not another computer. What is the IP address of the computer that is hosting the server at port 21?

I used different IP address, it is only an example.

The real programming is:

BeforeStart

open≔socket_open(“182.178.1.80”,21)

Loop open≟ False

open≔socket_open(“182.178.1.80”,21)

targetPos≔p[0,0,0,0,0,0]

counter≔0

And IP address of the computer is “182.178.1.80”, also i test other like “182.178.1.85”, and the IP of the robot is “182.178.1.90”.

The image of the programing of the robot is for a reference only, but is the same program the I have on the UR3

I would try running a socket test from another computer and make sure your server running on port 21 is accepting connections. I use SocketTest for testing server connections to make sure that the server is responding correctly.

This demonstration may help.