# Handling XMLRPC exceptions

**URL:** <https://forum.universal-robots.com/t/handling-xmlrpc-exceptions/14797>\
**Category:** URScript\
**Created:** [June 8, 2021, 6:00pm UTC](https://forum.universal-robots.com/t/handling-xmlrpc-exceptions/14797 "2021-06-08T18:00:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![avi](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@avi](https://forum.universal-robots.com/u/avi)\
**Post date:** [June 8, 2021, 6:00pm UTC](https://forum.universal-robots.com/t/handling-xmlrpc-exceptions/14797/1 "2021-06-08T18:00:43Z")

</div>

is it possible to handle an XMLRPC exception in URScript ?

I have a program which makes an XMLRPC call to an external server, but if the server is not available I would like to have a default action and not abort the program. is there a way to catch this exception and handle it in URScript ?

---

<div class="post-metadata">

**Author:** ![terryc](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/terryc/32/3006_2.png) [@terryc](https://forum.universal-robots.com/u/terryc)\
**Post date:** [June 9, 2021, 4:14am UTC](https://forum.universal-robots.com/t/handling-xmlrpc-exceptions/14797/2 "2021-06-09T04:14:26Z")

</div>

Not really. You could try connecting to it by socket which will return a true or false and then choose to connect to the xmlrpc server based on that result.

---

<div class="post-metadata">

**Author:** ![basti](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/basti/32/5982_2.png) [@basti](https://forum.universal-robots.com/u/basti)\
**Post date:** [March 21, 2024, 10:46am UTC](https://forum.universal-robots.com/t/handling-xmlrpc-exceptions/14797/3 "2024-03-21T10:46:36Z")

</div>

Hi there,

is ist still not possible to handle xmlrpc exceptions, e.g. if the server is not available?

I do not really want to connect via a second interface (socket) just to make sure that the server is available.

Thank you!

---

<div class="post-metadata">

**Author:** ![mattd](https://avatars.discourse-cdn.com/v4/letter/m/e9bcb4/32.png) [@mattd](https://forum.universal-robots.com/u/mattd)\
**Post date:** [March 13, 2026, 3:28am UTC](https://forum.universal-robots.com/t/handling-xmlrpc-exceptions/14797/4 "2026-03-13T03:28:54Z")

</div>

I have had to just add this same logic in to mine, it seems to work well as the timeout for socket connection is much faster…

```auto
def NotifyConnect():
  #Test connection with socket
  TestSocketConnected = socket_open("192.168.1.242", 50042, "Test_XMLRPC")
  if TestSocketConnected:
    socket_close("Test_XMLRPC")
    global XMLRPCConnected = True
    #Connect to XML-RPC Server for notifications / logging.
    global notify = rpc_factory("xmlrpc","http://192.168.1.242:50042/RPC2")
    notify.NotifyMsg("Robot Started.")
  else:
    socket_close("Test_XMLRPC")
    global XMLRPCConnected = False
  end
end

```
