# Socket communications

**URL:** <https://forum.universal-robots.com/t/socket-communications/36259>\
**Category:** URScript\
**Created:** [September 30, 2024, 5:45am UTC](https://forum.universal-robots.com/t/socket-communications/36259 "2024-09-30T05:45:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![raghuraman21356](https://avatars.discourse-cdn.com/v4/letter/r/4af34b/32.png) [@raghuraman21356](https://forum.universal-robots.com/u/raghuraman21356)\
**Post date:** [September 30, 2024, 5:45am UTC](https://forum.universal-robots.com/t/socket-communications/36259/1 "2024-09-30T05:45:34Z")

</div>

hello all,  
im currently working in ur5 cobot  
I tried to move the cobot ur5 with python sockets by below program

import socket  
import time  
host=‘192.168.10.2’  
port= 30002  
s=socket.socket(socket.AF\_INET,socket.SOCK\_STREAM)  
s.setsockopt(socket.SOL\_SOCKET, socket.SO\_REUSEADDR, 1)  
s.connect((host,port))  
msg=s.recv(1024)  
print(msg)  
s.send(“set\_digital\_out(0,True)”.encode())  
time.sleep(1)  
data=s.recv(1024)

When i execute the above code i can receive the data but when i execute script command, i cant see any responses from the cobot. Could you please tell anyone the major root cause for the issue. and it would be very helpful for me.  
Thanks!

---

<div class="post-metadata">

**Author:** ![cags](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/cags/32/6304_2.png) [@cags](https://forum.universal-robots.com/u/cags)\
**Post date:** [September 30, 2024, 8:15am UTC](https://forum.universal-robots.com/t/socket-communications/36259/2 "2024-09-30T08:15:18Z")

</div>

The port 30002 is the secondary interface, which is only for data. See this from the [client interfaces support page](https://www.universal-robots.com/articles/ur/interface-communication/overview-of-client-interfaces/):

`UR controller provide servers to send robot state data and receive URScript commands. The primary interface transmits robot state data and additional messages. The secondary interface transmits robot state data only.`

Try to change to port 30001

---

<div class="post-metadata">

**Author:** ![raghuraman21356](https://avatars.discourse-cdn.com/v4/letter/r/4af34b/32.png) [@raghuraman21356](https://forum.universal-robots.com/u/raghuraman21356)\
**Post date:** [November 13, 2024, 8:40am UTC](https://forum.universal-robots.com/t/socket-communications/36259/3 "2024-11-13T08:40:14Z")

</div>

Thankyou for your time and detailed response.  
I’ve just tried by adding ‘\n’ newline at the end of the script command, somehow it is working fine.  
Thanks again for your response!!
