Checking if remote device is still online

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
britishmonkey
Forum Newbie
Posts: 3
Joined: Thu Mar 17, 2011 2:01 pm

Checking if remote device is still online

Post 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
aIexi
Forum Newbie
Posts: 12
Joined: Wed Mar 16, 2011 10:46 pm

Re: Checking if remote device is still online

Post 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?
britishmonkey
Forum Newbie
Posts: 3
Joined: Thu Mar 17, 2011 2:01 pm

Re: Checking if remote device is still online

Post 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?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Checking if remote device is still online

Post 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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
britishmonkey
Forum Newbie
Posts: 3
Joined: Thu Mar 17, 2011 2:01 pm

Re: Checking if remote device is still online

Post 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.
Post Reply