in reply to Socket connection killing program

Looks you ignore close(socket filehandle), i mean like this :

sock($server);
sorry..typos
close $server;

Have a look at code below :

use strict; use IO::Socket qw(:DEFAULT :crlf); $/ = CRLF; my $port = 20000; my $false = 0; my $sock = IO::Socket::INET->new( Proto => 'tcp', LocalPort => $port, Listen => SOMAXCONN, Reuse => 1) or die "can't create socket $! \n"; warn "Waiting for Incoming connection on $port \n"; while(!$false) { next unless my $session = $sock->accept; my $client = gethostbyaddr($session->peeraddr,AF_INET) || $session-> +peerhost; my $port = $session->peerport; warn "Connection from [$client, $port]\n"; while(<$session>) { chomp; print $session "you typed $_ \n" ; } warn "Connection from [$client, $port] finished \n"; close $session } close $sock;