in reply to Re: How to share sockets between threads
in thread How to share sockets between threads


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
  • Comment on Re^2: How to share sockets between threads

Replies are listed 'Best First'.
Re^3: How to share sockets between threads
by BrowserUk (Patriarch) on May 10, 2006 at 08:04 UTC

    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.