# URScript ending and starting connection through socket

**URL:** <https://forum.universal-robots.com/t/urscript-ending-and-starting-connection-through-socket/22846>\
**Category:** Technical Questions\
**Created:** [July 22, 2022, 12:20pm UTC](https://forum.universal-robots.com/t/urscript-ending-and-starting-connection-through-socket/22846 "2022-07-22T12:20:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon38581660](https://avatars.discourse-cdn.com/v4/letter/a/e95f7d/32.png) [@anon38581660](https://forum.universal-robots.com/u/anon38581660)\
**Post date:** [July 22, 2022, 12:20pm UTC](https://forum.universal-robots.com/t/urscript-ending-and-starting-connection-through-socket/22846/1 "2022-07-22T12:20:31Z")

</div>

Hi,  
I am using the Polyscope to create a custom program for a UR10e and I have a few questions about sockets.  
The program in URScript is acting as a client and I am detecting the disconnection of the communication when I read an empty string and use the socket\_close to then close the connection. Is there a better way to detect the loss of the connection and should I be doing something else to properly close it?

Other thing is that sometimes when starting a connection fresh on both ends the URScript program will not connect to the listening server. Is there something that should be done in addition to or for configuration of the socket\_open call?
