Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > forking socket server under Windows

Reply
Thread Tools

forking socket server under Windows

 
 
Ed
Guest
Posts: n/a
 
      04-19-2004
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: socket.unbind or socket.unlisten? - socket.error: (48, 'Addressalready in use') Laszlo Nagy Python 0 02-01-2009 07:37 AM
socket.unbind or socket.unlisten? - socket.error: (48, 'Addressalready in use') Laszlo Nagy Python 1 01-27-2009 05:05 PM
Re: socket.unbind or socket.unlisten? - socket.error: (48,'Address already in use') Jean-Paul Calderone Python 0 01-27-2009 01:41 PM
Forking a daemonic Socket listener from a CGI script - browser times out Clyde Ingram Perl Misc 1 12-12-2003 04:11 PM
My Forking Server works in windows but not linux bob Smith Perl Misc 0 10-23-2003 09:48 PM



Advertisments