#!/usr/bin/perl -w
use IO::Socket::INET;
my $sock = IO::Socket::INET->new(Listen => 5,
				 Proto => 'tcp',
				 LocalAddr => '127.0.0.1',
				 LocalPort => 12345,
				 ReuseAddr => 1) || die $@;
while ((my $newsock = $sock->accept()))
{
    my $buf;
    $newsock->recv($buf, 1024);
    print $buf;
    undef $newsock;
}
