Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

nerfherder's scratchpad

by nerfherder (Monk)
on Jan 24, 2005 at 10:32 UTC ( #424550=scratchpad: print w/replies, xml ) Need Help??

#!/usr/bin/perl use strict; #use warnings; #use diagnostics; use CGI; my $query = new CGI; print $query->header(); use IO::Socket::INET; print "<main>"; print "<title> UPS Status </title>"; my $sock = new IO::Socket::INET->new(PeerPort=>20100, Proto=>'udp', PeerAddr=>'') or die "something we +nt wrong: $! "; my $request = "\xff\xff\xff\xff\x67\x65\x74\x69\x6e\x66\x6f\x20\x78\x7 +8\x78"; $sock->send($request); my $text; $sock->recv($text,235); my ($maxclients, $clients, $gametype, $mapname, $needpass); $text =~ s/\\/ /g; my @data = split(' ', $text); my $count = 0; foreach (@data) { chomp; if ($_ =~ m/sv_maxclients/) { print "<maxclients> $data[($count+1)] </maxclients>"; } if ($_ =~ m/clients/ && !($_ = m/sv_maxclients/)) { print "<players> $data[($count+1)] </players>"; } if ($_ =~ m/gametype/) { print "<gametype> $data[($count+1)] </gametype>"; } if ($_ =~ m/mapname/) { print "<mapname> $data[($count+1)] </mapname>"; } if ($_ =~ m/needpass/) { print "<needpass> $data[($count+1)] </needpass>"; } $count++; } print "</main>";
Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2016-09-25 12:53 GMT
Find Nodes?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:

    Results (470 votes). Check out past polls.