Re: How to know HTTP server is down

Giganews Newsgroups
Subject: Re: How to know HTTP server is down
Posted by:  Remy Lebeau \(Indy Team\) (re…
Date: Sat, 6 Feb 2010

"Alan T" <alan_NO_SPAM_plt…> wrote in message

> I want to test if HTTP server is up and running before GET a file.

Why?  Just GET the file and handle any errors that occur.  Don't waste your
time trying to test the server beforehand.  It is not worth it.

> I cannot GET the file for testing the HTTP server is running because
> the file is not always existing.

So?  The server will simply report HTTP error code 404 in that situation.
Your code can look for that condition.

> One way is to put a dummy file on HTTP server if I can GET
> the file

That is not necessary.  Just GET the original file normally.

> any other way I can test beside GET a file from HTTP server?

If you only care about connectivity but not functionality (not always a good
choice), then extract the Host and Port from the URL and Connect() to it
using TIdTCPClient by itself.

Remy Lebeau (Indy Team)



In response to

How to know HTTP server is down posted by Alan T on Tue, 2 Feb 2010