Ping IP to Make Sure Server is There

Discussion in 'C-Bus Wiser 2 Controller' started by sjfp, Feb 12, 2022.

  1. sjfp

    sjfp

    Joined:
    Oct 31, 2004
    Messages:
    145
    Likes Received:
    1
    Location:
    UK
    Hi, is there a way with a Wiser2 to be able to verify is a TCP Connection is still available.
    We control an AMP via TCP but sometimes the connection is lost, but the Wiser at the moment doesn't know this loss.
    Would like to get a procedure to check to make sure its still alive.

    Thanks for any suggestions
     
    sjfp, Feb 12, 2022
    #1
  2. sjfp

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,524
    Likes Received:
    173
    Location:
    Adelaide, Australia
    When a TCP connection is closed gracefully (i.e. under normal circumstances), it notifies the other end so it can tidy up and close it's own connection. If one end closes ungracefully (i.e. just crashes) the other end has no way of knowing until it tries to use the connection again. Pinging won't help you here because if the other end restarts it will respond to a ping, but the Wiser will still think the connection is present because nothing has told it that it isn't. The only way to confirm a TCP connection is to try and use it. If the other ends sends data regularly, you can use a timeout to determine if it has gone away. Otherwise you just need to send some data to it and see if it succeeds.

    Alternatively, if you don't use the connection regularly, just open it to send the data then close it again.
     
    Ashley, Feb 12, 2022
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.