Page 1 of 1

Checking if remote device is still online

Posted: Thu Mar 17, 2011 2:08 pm
by britishmonkey
Hi.

Is there any PHP function that allows me to check if a device is still online?

I have one computer managing information (writing to a file) whilst another is using that information but i need the main computer to know if the other has lost its connection to the internet. Is there a way to check via the IP or something? Anything that writes to a database seems worthless since a lost connection wont trigger a change to the database.

Thought there might be some function that could check the IPs viewing a file or something?

Many thanks in advance

Re: Checking if remote device is still online

Posted: Thu Mar 17, 2011 5:51 pm
by aIexi
Wow, that's so odd. Are you running like a database on one computer, and then using the other to run like php files or w.e?

Re: Checking if remote device is still online

Posted: Fri Mar 18, 2011 9:41 am
by britishmonkey
Hmm ..... odd? Simple really.

One computer writes data to a file. Other computer reads said data from file via php. Any way for the 1st computer to know if the computer reading the data is no longer online?

Re: Checking if remote device is still online

Posted: Fri Mar 18, 2011 10:00 am
by pickle
If the 2nd computer has a static IP, you could try to ping that IP.

Without knowing more, this seems like a bandaid fix, not a solution. If the network connectivity of the 2nd computer is that uncertain, you should fix that problem.

Re: Checking if remote device is still online

Posted: Fri Mar 18, 2011 10:53 am
by britishmonkey
Thx Pickle - will look for some PHP code that pings an IP.

The reliability of the other computer is irrelevant to this question. All I want is to know if PHP can check such a thing in the event it happens. Didn't think this question would give rise to so many other questions on here - either PHP has this capability or not, I would have thought.