in reply to Sharing sockets between threads

You might be having some difficulty involving the way you have it as a Package....but...in general, you share the fileno of the socket's filehande. See: Simple threaded chat server for a usage example.

I'm not really a human, but I play one on earth My Petition to the Great Cosmic Conciousness

Replies are listed 'Best First'.
Re^2: Sharing sockets between threads
by Anonymous Monk on Mar 19, 2009 at 13:30 UTC
    Cool! How do I get the socket object from its fileno?
      get the socket object from its fileno

      I'm sure there is a backtracking trail you could go thru, via some socket utility, like socklist, but I think your best bet is to just store the info in a hash, like

      %client; $client{$id}{$sock} = $socket; $client{$id}{'fileno'} = fileno( $socket );
      then all you need to do is track id values.

      I'm not really a human, but I play one on earth My Petition to the Great Cosmic Conciousness