#!/usr/bin/perl
$auth_enabled = 0;
$auth_login = "hidden";
$auth_pass = "hidden";
$port = 44269;
use IO::Socket::INET;
$SIG{'CHLD'} = 'IGNORE';
$bind = IO::Socket::INET->new(Listen=>10, Reuse=>1, LocalPort=>$port) or die "Нельзя забиндить порт $port\n";
while($client = $bind->accept()) {
$client->autoflush();
if(fork()){ $client->close(); }
else { $bind->close(); new_client($client); exit(); }
}
sub new_client {
local $t, $i, $buff, $ord, $success;
local $client = $_[0];
sysread($client, $buff, 1);
if(ord($buff) == 5) {
sysread($client, $buff, 1);
$t = ord($buff);
unless(sysread($client, $buff, $t) == $t) { return; }
$success = 0;
for($i = 0; $i < $t; $i++) {
$ord = ord(substr($buff, $i, 1));
if($ord == 0 && !$auth_enabled) {
syswrite($client, "\x05\x00", 2);
$success++;