in reply to How to share sockets between threads

I forgot to add, I am using Windows XP with Perl 5.8.8
  • Comment on Re: How to share sockets between threads

Replies are listed 'Best First'.
Re^2: How to share sockets between threads
by earlati2 (Beadle) on May 10, 2006 at 07:20 UTC

    substitute the line:
    $CLIENTS{$clientID} = &share($newClient);
    as show belowe ( put $newClient inside braket square )
    $CLIENTS{$clientID} = &share([$newClient]);

    I test it on a win2000 with perl 5.8.7 and it works

      This doesn't work. It prevents the error message, but what it actually does is

      • Creates an anonymous array containing the glob.
      • It then shares the anonymous array--but when you share an array, all its contents are silently discarded!
        use threads; use threads::shared;; use IO::Socket::INET;; $sock = IO::Socket::INET->new( 'localhost:12345' );; $ref = &share( [ $sock ] );; print $ref;; ARRAY(0x2253c8) print $#$ref;; -1 #### The anonymous array is EMPTY!

      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.