Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Reading from more than one socket at once

by ahunter (Monk)
on Jul 05, 2000 at 00:07 UTC ( #21054=perltutorial: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      # FILE1 & FILE2 is a filehandle opened elsewhere. $read is a list of
      # filehandles we are interested in reading
    ...
                                        # (NOTE: $read=0 is very wrong)
      vec($read, fileno(FILE1), 1) = 1; # Set the appropriate bit
      vec($read, fileno(FILE2), 1) = 1; # And for another file...
    
  2. or download this
      my $nfound = select($read, undef, undef, undef);
    
  3. or download this
      # Does FILE1 have data waiting?
      if (vec($read, fileno(FILE1), 1))
        {
          # ... do stuff ...
        }
    
  4. or download this
    #
    # Simple multiplexing package
    ...
    
    # ==
    return 1;
    
  5. or download this
    #
    # TCP listener socket
    ...
    
    # ==
    return 1;
    
  6. or download this
    package sillyTimer;
    
    ...
      {
        Multiplex::despatchevents()
      }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perltutorial [id://21054]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2014-07-26 02:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls