# Pause or stop the program

**URL:** <https://forum.universal-robots.com/t/pause-or-stop-the-program/7952>\
**Category:** Java\
**Created:** [July 1, 2020, 2:57am UTC](https://forum.universal-robots.com/t/pause-or-stop-the-program/7952 "2020-07-01T02:57:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tonyke](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/tonyke/32/143_2.png) [@tonyke](https://forum.universal-robots.com/u/tonyke)\
**Post date:** [July 1, 2020, 2:57am UTC](https://forum.universal-robots.com/t/pause-or-stop-the-program/7952/1 "2020-07-01T02:57:15Z")

</div>

Which method should be called when the daemon detects abnormal data to pause or stop the program? please give me your advice

---

<div class="post-metadata">

**Author:** ![fujikit](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/fujikit/32/6042_2.png) [@fujikit](https://forum.universal-robots.com/u/fujikit)\
**Post date:** [July 1, 2020, 12:08pm UTC](https://forum.universal-robots.com/t/pause-or-stop-the-program/7952/2 "2020-07-01T12:08:07Z")

</div>

Did you try access to dashboard? (port 29999)

[https://www.universal-robots.com/articles/ur-articles/dashboard-server-cb-series-port-29999/](https://www.universal-robots.com/articles/ur-articles/dashboard-server-cb-series-port-29999/)

---

<div class="post-metadata">

**Author:** ![anon77005701](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@anon77005701](https://forum.universal-robots.com/u/anon77005701)\
**Post date:** [August 6, 2020, 12:08pm UTC](https://forum.universal-robots.com/t/pause-or-stop-the-program/7952/3 "2020-08-06T12:08:51Z")

</div>

I got the program to stop using these commands in python

```
def start_socket():
    HOST = "0.0.0.0" # The remote host
    PORT = 30002 # The same port as used by the server
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect((HOST, PORT))
    return s

def close_socket(s):
    s.close()

def send_command_to_ur(s, command):
    s.send(command)

def stopRobotProgram():
    c = (
	    "halt" + "\n"
    ).encode()
    send_command_to_ur(s, c)
```
