Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Reading from more than one socket at once

by ahunter (Monk)
on Jul 05, 2000 at 00:07 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: perltutorial [id://21054]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-04-26 03:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found