Check if networked computer is on?

agehoops

Registered User.
Local time
Today, 12:32
Joined
Feb 11, 2006
Messages
351
How do I check if another computer is on?

Basically the back end is going to be stored on a computer (no server involved. Small P2P network) and it obviously needs to be on for everyone to access it.

Is there a way of checking if that computer is on first before doing anything else? I can check if the back end exists, but it existing and the computer being off are 2 different things and I want it to have 2 different errors for this.

Thanks
 
Two things jump to mind.
1) Don't turn the suspect computer off.
2) Test for the existence of a known folder.
I don't think you can prove in code that the machine is off, but only that it's resources are not available.
 
well the computer isn't a server so it gets turned off daily which is a bit of a pain but that's life.

I'd thought of testing a folder for existence. Basically the computer holds the back end, and I wanted to have 2 error messages. One stating that the computer is simply off so the back end can't be accessed, and a second stating that the backend doesn't actually exist. The latter of the 2 was easy and is working, I was just hoping to be able to test if the machine was actually on.
 
Unfortunately there is no way to differentiate between a remote computer that is switched off and one which has lost its network connection. The best you can do if you needto have two messages is to check if you can acces a known folder and if you can access the BE.
 
To see if the machine is alive and on the network you should be able to ping it, if you know its IP address and/or host name.
You can use VB code (Google for it or search http://vbnet.mvps.org/), or you can write a batch file and call it using Shell. Both of these will need a bit of work however!
 
How about trying to create a text file where the BE exists. If you can not create the text file the computer must be off. If you can create the text file but not enter the be the back end is gone. Would this work? You can use the file system object
 
Why not buy another PC to act as a server and leave it switched on? At around £300 it's hardly a major investment. I doubt if £300 would pay for much of your time?
 
I think i'll do either the text file or testing of a folder, and talk with them about either a NAS drive or a small server which as you say is cheap, and I've got a spare computer they could use.

You see they can't spend too much money as it is a charity so they don't have loads of money to just spend.

I could ping the machine, however the IP address may change. The IP address is assigned by a DHCP server which makes it dynamic so it may suddenly change unless I made it static.
 
Testing to see if a computer is off is like nudging the person next to you in bed and asking if they're awake. If they're asleep, you won't get an answer. If they're ignoring you, you also won't get an answer.

Writing a text file doesn't necessarily mean the computer is off. It can mean the network connection on either end (yours or the pseudo-server) is down.

The best you're going to do here is to make a more generic error message, something like: "The host machine is unavailable. It may either be shut off or there may be a network error."

Is the error message very useful? Only in the sense that you know something is wrong and it's narrowed down to a few possibilities. However, it's a lot better than "ODBC - Call Failed" which could mean about two dozen things. And, of course, it's way better than, "Keyboard not found. Press any key to continue."
 
Well at the moment it comes up saying that either the back end doesn't exist, OR the computer is switched off. Please check the computer first, and if it is on then relink the back end
 
Most helpful error message I have seen was "Unexpected input not found".
 
haha I would so love to see that!!!

It was actually a higher level error message which should have read "Unexpected 'Input not found'". The joys of some computer manufacturers in the 1970s
 

Users who are viewing this thread

Back
Top Bottom