[ajug-members] checking for server availability

Rob Worsnop rworsnop at gmail.com
Fri Apr 6 11:37:28 EDT 2007


Depends if you want to know if your application is healthy or just
whether or not the server is still listening on the specified port.

If the latter, you can just try opening a socket and interpret
ConnectException as a heartbeat failure. If the server machine is
still up, but no longer listening on the port, it should respond
immediately with an RST/ACK (which gets translated to a
ConnectException). If the machine has caught fire or had a
refrigerator dropped on it, your socket will time out at your end and
you'll have to wait a little while to get your ConnectException.

On 4/6/07, Barnes, Mike <mike.barnes at cingular.com> wrote:
>
>
>
>
> Is there a way to ping a host/port to see if it is available? I need to set
> up a heartbeat process and would like to do it as cheaply as possible
> (network time). The current way we are doing this is to send a known message
> to the server and wait for a response, I am not sure that this is the best
> way to check if a server is up or not.
>
>
>
> Thanks
>
> Mike Barnes
> _______________________________________________
> ajug-members mailing list
> ajug-members at ajug.org
> http://www.ajug.org/mailman/listinfo/ajug-members
>
>



More information about the ajug-members mailing list