# When socket\_close() is called?

**URL:** <https://forum.universal-robots.com/t/when-socket-close-is-called/3368>\
**Category:** URScript\
**Created:** [January 2, 2019, 5:38am UTC](https://forum.universal-robots.com/t/when-socket-close-is-called/3368 "2019-01-02T05:38:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon61101646](https://avatars.discourse-cdn.com/v4/letter/a/c89c15/32.png) [@anon61101646](https://forum.universal-robots.com/u/anon61101646)\
**Post date:** [January 2, 2019, 5:38am UTC](https://forum.universal-robots.com/t/when-socket-close-is-called/3368/1 "2019-01-02T05:38:03Z")

</div>

Normally URP program calls socket\_open and keep open state.  
Sometimes later program is stopped by user in polyscope. and restarted.  
In that case, we could not call socket\_close() explicitly when stopping.  
Does URControl process call socket\_close() internally?

---

<div class="post-metadata">

**Author:** ![jbm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/jbm/32/614_2.png) [@jbm](https://forum.universal-robots.com/u/jbm)\
**Post date:** [January 2, 2019, 8:40am UTC](https://forum.universal-robots.com/t/when-socket-close-is-called/3368/2 "2019-01-02T08:40:03Z")

</div>

When a program using sockets is stopped, all remaining open sockets are closed.  
However it is good practice, to use `socket_close()` yourself to ensure proper housekeeping.
