sendtopeer() in luascript when internet is down.

Hi all,
I am trying to duplicate the data of an orthanc server using peer mechanism.
I have a local orthanc server which has a luascript like below.

function OnStoredInstance(instanceId, tags, metadata)
SendToPeer(instanceId, ‘peer1’)

In my config file I am setting my peer1 as another orthanc server over http.

// The list of the known Orthanc peers
“OrthancPeers” : {

  • Each line gives the base URL of an Orthanc peer, possibly
  • followed by the username/password pair (if the password
  • protection is enabled on the peer).
    “peer1” : [ “http://MYREMOTESERVERIPADDRESS:8042/”, “orthanc”, “orthanc” ]


This works fine when a new instance is created in my local machine when the internet is working. But when the network is down and I create a new dicom instance it tries to connect to the server and fails. But it never retries.

How to resend the new instances to the remote server using http ? I am not sure what am I missing here.

Thanks in advance



The Lua engine is not expressive enough to deal with more evolved scenarios such as yours.

In such situations, please use an external script (e.g. in Python) that targets the REST API of Orthanc:


Thanks Sébastien.