#!/usr/bin/perl -w use strict; use IO::Socket; my $new_sock; my $buf; my $sock = new IO::Socket::INET (LocalHost => 'foo', localPort => 1880, Proto => 'tcp', Listen => 5, Reuse => 1 ); die "Unable to create socket: $!" unless $sock; print "Waiting for message...\n"; while ($new_sock = $sock->accept()) { print $buf while (defined ($buf = <$new_sock>)) } close ($sock);