Showing results for 
Search instead for 
Did you mean: 

TCP/IP connection between PC and UR5 Universal Robot


I have a UR5 robot connected to a PC via ethernet. I am currently trying to have the robot and PC send strings back and forth via the TCP/IP functions in LabVIEW. Using the code below I have been able to recieve strings from my robot sent to my pc, but have been unable to send strings from my to my robot. I am able to send and recieve strings in both directions via the program Sockettest. Does anyone have a lot of TCP/IP knowledge and know how to send strings from my PC to my robot? Alternatively does anyone know how I could connect Sockettest to my LabVIEW code?



Message 1 of 20

Actually you can use LabVIEW example in Help>>Find Examples>> Search Tab>>Simple TCP

You would see something like this.

Simple TCP.png

0 Kudos
Message 2 of 20

Hi robotathon,

I have a UR5 robot like yours, but I'm not able to recieve string from the robot. I'm sending script commands to the robbot using the port 30002 but I can not recieve info from the robot.

Do you find the way to communicate with the UR5? (back and forward), coud you share information? 

0 Kudos
Message 3 of 20

Loop 2 Times

   Socket_Test:=socket_open("local IP adress of computer here",port number here)

   Wait 0.1


    wait 0.1








1. The recieve part of the script must be looped or the connection will be timed out and no data will be sent

2. My code is spefically for send and recieving robot position, if you are just sending scripts you won't need "get_forward_kin()", and "socket_read_ascii_float(6)" will probably be replaced by "socket_read_string()"

3. socket_send_byte() functions as a carriage return

4. No data sent from the robot will appear in LabVIEW until the "socket_close()" command is run so you may need to open and close the connection multiple times in the same program


Pictures of my applicable LabVIEW are attatched, let me know if you have any more questions



0 Kudos
Message 4 of 20

Hi robotathon


I studied your work and figured out your problem. Please see attached pictures.


0 Kudos
Message 5 of 20

Hello, can you give me the vi? I'am  trying to connect my pc to UR5. Thank you!

0 Kudos
Message 6 of 20

Hi seraph1989,


Can you please share the .vi for the above program, we are trying to control an universal robot via labview.


thanks in advance

Message 7 of 20

I have a problem with the communication PC-UR5, can you help me pelase, my email is:

thank you so much.

I hope to help me.  

Do you have any tutorial?? 

0 Kudos
Message 8 of 20

Hi, a faster and easy way to control the UR5 with TCP/IP connection:

1.- sending function scripts, just like the you can find in the manual "The URScript Programming Language" (

This is a faster and easy communication, but one way communication. So the “one way” commands cannot read something back, so reading of inputs or getting the result of a “get_inverse_kin” command will not return the result with this method

Sending functions scripts.JPG

Message 9 of 20

Hi,  I am trying to make a small Ui for dashboard server on port 2999.

When I send a command String, robot behaves as expected but,  I don't get any reply.

I have a Parellel loop running which is reading incoming data, but I am not getting any data from the robot, 

Things tried 

1.Data comes Inc socket test application 

2. Looped twice for read data 

3. Closed connection after read vi

Any suggestion to read robotmode

0 Kudos
Message 10 of 20