#!/usr/bin/perl -w use strict; use IO::Socket::INET; my $server =IO::Socket::INET->new(LocalPort => 4848, Listen=> 1,ReuseAddr => 1) or die "listen: $!"; my $client; USER: while($client= $server->accept()){ if (my $pid = fork()){ #parent close $client; $SIG{CHLD} = sub {}; }else{ print $client "hello, world!\n"; select(undef,undef,undef,2); exit; } } warn "fell out of loop - $!";