Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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 musing on the Monastery: (8)
As of 2014-11-22 21:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (125 votes), past polls