forking socket server under Windows

Discussion in 'Perl' started by Ed, Apr 19, 2004.

  1. Ed

    Ed Guest

    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
     
    Ed, Apr 19, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Laszlo Nagy
    Replies:
    1
    Views:
    4,943
    Mark Wooding
    Jan 27, 2009
  2. Jean-Paul Calderone
    Replies:
    0
    Views:
    996
    Jean-Paul Calderone
    Jan 27, 2009
  3. Laszlo Nagy
    Replies:
    0
    Views:
    571
    Laszlo Nagy
    Feb 1, 2009
  4. bob Smith
    Replies:
    0
    Views:
    129
    bob Smith
    Oct 23, 2003
  5. Clyde Ingram
    Replies:
    1
    Views:
    479
    Randal L. Schwartz
    Dec 12, 2003
Loading...

Share This Page