The easiest solution is to shell a ping command, and redirect the output to a temporary file. Open the Temporary file, and have your VB Program read in the lines (compare using instr) and check if there is a timeout, or if there is a response from the server. If there is a response from the server, naturally, the server is up. If you get, instead, a ping timout, then the server is down. If you really want to get fancy about it, you could try to connect the server on port 80 (the web page port), rip apart the HTML, and have it figure if the image is Red or Green. The first option is clearly easier, and is just as effective. Let me know if you need any further assistance in this.
yea ill just put a better description of what i am trying to do.
this server is used to host the game World of Warcraft, and im trying to get a small program to run that will connect to the server, telling me if the server is up or down. but i dont know how to get it to connect to the server properly.
becasue i have never done anything like this before, i would like sum help doing it.
i can make the UI for it, or even better could someone tell me how to get it to run in the system try so that i can keep it running whilst doing other things.
or if anyone knows of somewhere that i can download a program that already does this simply.
you can use cron or the at command on IX flavored systems for "timing"
SNMPD is designed for monitoring systems. Is also installed on IXs by default and sometimes fault on Windows. Loads of good suggestions on this thread guys.
Wow, Cain, Thanks for that. However, The Forum is "Visual Basic" and to my knowledge (even with the use of wine on a wicked system) VB will NOT Run on a *nix box. I've tried. So, Should the thread be related to merely checking a server's status, that would be awesome, but this is a windows computer programming forum.
Mkay, And The Updated Version, Which is still not perfect and contains some minor flaws, but does exactly what you want. You may need to copy the tray.ocx to your windows\system32 folder, or just replace the one in the project with the one in the zipped folder... either way, the program works like a charm for me.
I'll tell you what, you need to either A) Ask the Admin What PORT it runs on (or if you know what port it is, that's cool. You could always be connected to the game, go to a DOS prompt, and run NetStat, and give me the statistics of it.) Once I know the PORT and the Server IP, I'll build you one using Sockets, which will connect to the Game Port of the server, and not just to see if the box itself is up or down.
It doesn't look like that's correct. I ran a port scan on the server: xaoswow.servegame.com, and that port doesn't show up as being open. At the same time, the web page shows a green box, meaning the server is up. Either you have the port wrong, or the server wrong.
While you are playing the game, hit cntrl-alt-delete, it will load task manager, but more importantly, will bring you back to windows While The Game Is Still Running!
Once Back in windows, click start, go to run, and type in cmd. You will get a black box window (a dos prompt), type in (at the black window) netstat. Take all the information it gives you, and either post it here, or e-mail me all that data. I'll sift through it, and find the server and port needed for this program.
If you want to know how they did it you could ask then for the source code of their status.php program. That is what determines the color of the square in the web page. In the code of ServerCheck.php you can see them calling it SRC="status.php?link=xaoswow.servegame.com"
Creds to Comatose for inventive uses of .bat files and their results.