Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Mar 10th, 2012  |  syntax: Perl  |  size: 0.61 KB  |  views: 28  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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();