tags:

views:

49

answers:

3

Hello,

This has been bothering me for awhile, can some one show me how to ping a counter strike server.

I just want to ping the server and see if it is online, thats all.

I found many small snippets online that were using fsock and UDP to do this but none of them actually did the job i wanted it to do.

Most of the ones i found were showing offline servers as online.

I would really really appreciate if some one could provide me with this useful information (code).

Thank you in advance ^_^

A: 

Two choices off the top of my head:

fsockopen:

http://www.phptoys.com/e107_plugins/content/content.php?content.41

Net_Ping Pear package:

http://www.codediesel.com/php/ping-a-server-using-php/

Using IP of the CS server.

Kerry Peterson
Thanks, the first link i found already but it doesn't do the job.The second link is something like what i need - but it requires alot of things that i would have only if i had root access.Alot of the stuff it requires is disabled on my server (i.e exec() function).
Zubair1
A: 

Get ClanManager and it has modules to check status of CS server.

This is the file with examples talking with CS servers,

http://clanmanager.cvs.sourceforge.net/viewvc/clanmanager/ocm/server/counterstrike.inc?revision=1.3&view=markup

ZZ Coder
Thanks for the link - the code look on that class looks pretty outdated and not what i was interested in.I don't want to Query the Server for its information, i just need ping it to Only verify that it's online and alive.http://gameq.sourceforge.net is better than the above one, if i had to choose though.
Zubair1
A: 

You can also do what's known as a TCP ping. Basically, you just connect then disconnect without any communication. If the connection succeeds, you know the server is up, if it fails it's down. When I say server I mean the program you're interested in, not the physical server.

Robert S. Barnes