Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2005
    Posts
    93
    Thanks
    4
    Thanked 0 Times in 0 Posts

    How to make sure remote server is up and running?

    Hello,

    I'm building a very simple app that relies on a remote server. I will use this app on many websites, so I decided to store it on one server (I have control of the remote server in question).

    I need to make sure that this server is up and running, so in the case it's not I can use a fallback.

    Would it be a client-side approach? A server-side approach? My guess is to use a js snippet to do the job. If I'm correct, I'll probably use jquery to perfom the task.

    Regards,

    -jj.

  • #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,460
    Thanks
    11
    Thanked 600 Times in 580 Posts
    find any image file on the remote server, and note it's url.
    you can often use icons on error pages if the content pages themselves don't have images...

    if the remote server has an image, you can spy on it from any other site (almost feels like cheating huh?).


    here is a working example to monitor this site:
    Code:
    var i=new Image;
     i.onload=function(){alert("server up: "+this.src.split(/\/{1}/)[2]);};
     i.onerror=function(){alert("server down: "+this.src.split(/\/{1}/)[2]);};
     i.src="http://www.codingforums.com/images/misc/navbits_finallink_ltr.gif";

    watch out for redesigns...
    Last edited by rnd me; 07-12-2011 at 08:12 PM.
    my site (updated 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •