I have a systemlink Python application running and working that is essentially the following simplified code (error checks were removed for simplicity):
 
mgr = TagManager(httpCfg)
with ExitStack() as stack:
     paths = ["tags*"]
     selection = stack.enter_context(mgr.open_selection(paths))
     subscription = stack.enter_context(selection.create_subscription(update_interval=timedelta(milliseconds=250)))
     subscription.tag_changed += on_tag_changed
     try:
          while True:
          sleep(1)
     except KeyboardInterrupt:
          pass
 
 
My question is, how can a loss of socket communication be detected (e.g. if the Ethernet cable is removed), in order to reinitialize from the HttpConfiguration (I assume that's where the reinitialization would have to occur)?