#!/usr/bin/perl -w
use strict;
use IO::Socket;

my $socket = IO::Socket::INET->new(
  Listen => 5,
  Proto => "tcp",
  LocalPort => 2345,
  ReuseAddr => 1,
)
or die "Problem: $!";

while (my $client = $socket->accept) {
  my $line = <$client>;
  print "Verbindung von " . $client->peerhost . ": $line";
  print $client "Demo\r\n";
}
