Detecting if server program running  
Author Message
Ron Hiler





PostPosted: 2003-9-19 10:40:19 Top

php-general, Detecting if server program running Hi guys,

I'm a C++ programmer, and I have created a game which has a client/server
architecture. What I would like to do is have my web page show if the
server is up and how many people are logged in at the time. Every five
minutes or so, I'd like for the web page to ping for the server, and if the
server is up, it should return a packet with the population number, which I
can then display on the front page. If there is no response from the server
(in, say, 5 seconds), then the page should show it as down.

Unfortunately, I'm a horrible php coder :) I can handle the server end code
no problem, as long as I know what to send such that the php code can read
it. What I don't know is how to send the initial request from the web page
to the server.

Both my web page and my server have fixed IP addresses. My page has a MySQL
database that I could use to store the information between pings if that
helps. Is it possible to do what I'm after with the tools I have?

Any advice/tips/links?

Thanks -Ron


 
Randell D.





PostPosted: 2003-9-20 0:18:00 Top

php-general >> Detecting if server program running
"Ron Hiler" <email***@***.com> wrote in message
news:3f6a6bae$1@wobble...
> Hi guys,
>
> I'm a C++ programmer, and I have created a game which has a client/server
> architecture. What I would like to do is have my web page show if the
> server is up and how many people are logged in at the time. Every five
> minutes or so, I'd like for the web page to ping for the server, and if
the
> server is up, it should return a packet with the population number, which
I
> can then display on the front page. If there is no response from the
server
> (in, say, 5 seconds), then the page should show it as down.
>
> Unfortunately, I'm a horrible php coder :) I can handle the server end
code
> no problem, as long as I know what to send such that the php code can read
> it. What I don't know is how to send the initial request from the web
page
> to the server.
>
> Both my web page and my server have fixed IP addresses. My page has a
MySQL
> database that I could use to store the information between pings if that
> helps. Is it possible to do what I'm after with the tools I have?
>
> Any advice/tips/links?
>
> Thanks -Ron
>
>

PHP is a server side meaning the client (web browser) has no access to it.
When a web page link is selected, or a page visited, the server works in the
background to give whatever results your PHP program specifies.

I would think that you need a javascript (or java) based solution for the
client side. To confirm if the server is available or not, you could
perform a test if an image exists or not on the remote server and use it as
a flag file with javascript, but I'm sure java must have some more flexable
and environmentally friendly solutions...