use strict; use warnings; use IO::Socket::INET; use IO::Select; my $Port = 2005; my $server = IO::Socket::INET->new( LocalPort => $Port, type => SOCK_STREAM, Reuse => 1, Listen => 10 ) or die "Server läuft nicht: $@\n"; my $select = IO::Select->new($server); while (my @readable = $select->can_read) { for my $socket (@readable) { if ($socket == $server) { print "New client connects\n"; my $client = $socket->accept; $select->add($client); } else { my $byte = $socket->getc; if (defined $byte) { print "$byte\n"; if ($byte eq "!") { $socket->print("\$OK!"); } } else { print "Connection closed by client\n"; delete_socket($select, $socket); } } } } sub delete_socket {...}