6 my $port = shift || 13131;
8 my $server = IO::Socket::INET->new(
13 || die "can't setup server";
14 print "[Q3Map2 listener $0 is now active on port $port]\n";
16 while( $client = $server->accept() )
19 $client->autoflush( 1 );
21 $hostinfo = gethostbyaddr( $client->peeraddr );
22 printf "[Connect from %s]\n\n", $hostinfo ? $hostinfo->name : $client->peerhost;
24 #ask the client for a command
25 print $client "[server]\$";
30 while( $text =~ s|<message[^>]*>([^<]+)</message>|| )
37 $msg =~ s|"|"|g;#"
38 $msg =~ s|'|'|g;#'
44 printf "\n[Disconnected: %s]\n\n", $hostinfo ? $hostinfo->name : $client->peerhost;