SHARE
TWEET

Untitled

a guest Mar 10th, 2012 33 Never
  1. #!/usr/bin/env perl
  2.  
  3. my $masterhost = 'play.redeclipse.net';
  4. my $masterport = 28800;
  5.  
  6. use IO::Socket::INET;
  7. $| =1;
  8.  
  9.  
  10. my $socket = new IO::Socket::INET (
  11.         PeerHost => $masterhost,
  12.         PeerPort => $masterport,
  13.         Proto    => 'tcp',
  14.         Timeout  => 4,
  15. ) or die "Failed to contact master server: $!\n";
  16.  
  17. #print <$socket>;
  18. print "Connected to master server\n";
  19.  
  20.  
  21. my $post = 'update';
  22. print $socket "$post\n";
  23.  
  24.  
  25. while (<$socket>)
  26. {
  27.         if( $_ =~ m/addserver\ (\d+).(\d+).(\d+).(\d+)\ (\d+)/)
  28.         {
  29.                 print "$1.$2.$3.$4:$5\n";
  30.         }
  31. }
  32.  
  33. $socket->close();
RAW Paste Data
Top