forking socket server under Windows

E

Ed

Trying to fork a socket server, but when file is transferred and child
exits the error:

Free to wrong pool 1e090e0 not 223fb0


Reasonable code facsimile:
$SIG{CHLD} = \&REAP;
my $sock = new IO::Socket::INET(
LocalPort => $port,
Proto => 'tcp',
Listen => SOMAXCONN,
Reuse => 1);
$sock or die "no socket : $!";

while ($client = $sock->accept()) {

if ($pid = fork) {
close $client;
} elsif (defined ($pid = fork)) {
# receive data
exit;
} else die "cannot fork";
}


sub REAP {
1 until (-1 == waitpid(-1, WNOHANG));
$SIG{CHLD} = \&REAP;
}


I must have missed something in the thousands of examples I reviewed.

ed
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,218
Latest member
JolieDenha

Latest Threads

Top