use IO::Socket::INET; #ignore child processes to prevent zombies $SIG{CHLD} = 'IGNORE'; my $socket = IO::Socket::INET->new( LocalPort => 1776, Type => SOCK_STREAM, Reuse => 1, Listen => 10 ) or die "Big Problem with the Server, Man : $!\n\n"; while ( my $client = $socket->accept() ) { my $child; # perform the fork or exit die "Can't fork: $!" unless defined ($child = fork()); if ($child == 0) { #i'm the child! #close the child's listen socket, we dont need it. $socket->close; #call the main child rountine print $client 'Hello, down there!!', "\n\n"; $msg = <$client>; ### ** When one child is here the others seem to hang until its done ** #if the child returns, then just exit exit 0; } else { #i'm the parent! #who connected? warn "Connecton recieved ... ",$client->peerhost," ... Sent to Child: $child\n"; #close the connection, the parent has already passed # it off to a child. warn "Waiting for Child to start...\n"; sleep(1); # Give the child a moment to start warn "Closing Parent connection.\n\n"; $client->close(); } } close($socket); exit 0;