use IO::Socket; use IO::Select; $hname = "localhost"; $hport = $ARGV[0]; $sock = new IO::Socket::INET->new(LocalPort => $hport, Listen => 10, Reuse => 1, Proto => 'tcp'); $sel = new IO::Select->new(); $sel->add($sock); $sel->add(*STDIN); die "*Could not Connect" unless $sock; while(1){ while ($line = ){ while(@ready = $sel->can_read) { foreach $fh (@ready) { if ($fh == $sock) { $new = $sock->accept; $sel->add($new); print "Willkommen"; } elsif($fh == *STDIN) { $buf = ; print "Client\n"; client($buf); } else{ $sel->remove($fh); $fh->close; } } } }