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. Advertisements

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. hshdude
    Replies:
    12
    Views:
    1,352
    Dimitri Maziuk
    Nov 4, 2004
  2. Colin Brown

    Qn: Socket performance under Windows

    Colin Brown, Nov 12, 2003, in forum: Python
    Replies:
    0
    Views:
    437
    Colin Brown
    Nov 12, 2003
  3. Laszlo Nagy
    Replies:
    1
    Views:
    7,239
    Mark Wooding
    Jan 27, 2009
  4. Steve Holden
    Replies:
    1
    Views:
    1,005
  5. groowey

    Socket problem under Windows

    groowey, Feb 18, 2006, in forum: Ruby
    Replies:
    0
    Views:
    132
    groowey
    Feb 18, 2006
  6. bob Smith
    Replies:
    0
    Views:
    208
    bob Smith
    Oct 23, 2003
  7. Clyde Ingram
    Replies:
    1
    Views:
    647
    Randal L. Schwartz
    Dec 12, 2003
  8. Stefan Ram
    Replies:
    5
    Views:
    1,348
    Stefan Ram
    Mar 17, 2014
Loading...