Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi, I've only been using perl for about 2 years now, but I've only really used it for CGI and performing quick and dirt tasks on my linux box, but I have been proposed with a new problem.
Does Perl have anything that would allow me to ping something like a CounterStrike or HalfLife server and get information about the current game running?? I've seen this done on other websites, but I wasn't sure if they were using Perl or one of their own creations.
Re: Gathering server information
by esskar (Deacon) on Apr 11, 2004 at 14:18 UTC
|
Hi.
well, i do not know about CS but PING is not a problem
use Net::Ping;
my $host = 'perlmonks.com';
my $p = Net::Ping->new();
print "$host is alive.\n" if $p->ping($host);
$p->close();
| [reply] [d/l] |
Re: Gathering server information
by eXile (Priest) on Apr 11, 2004 at 15:58 UTC
|
I think lots of information on this can be found via google. You'll need the specs for the communication protocol that is used for these servers (or an example program from which you can 'reverse engineer' the protocol). I think this site has some relevant information on programming for HalfLife. The search for Counterstrike information is left as an exercise to the reader.
;-)
I think this might be a great way to learn network programming in perl, and maybe you'll even end up writing modules for these protocols and upload them to CPAN (I didn't find any modules there yet).
| [reply] |
|