Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: What is the easy way to check if the socket has data to read, before do a read()

by perlknight (Pilgrim)
on Jul 24, 2002 at 14:21 UTC ( [id://184851]=note: print w/replies, xml ) Need Help??


in reply to What is the easy way to check if the socket has data to read, before do a read()

Use IO::Select, pass the socket handle to it and use can_read method to detemine if the handle is ready, here's snippet from perldoc:
use IO::Socket; use IO::Select; $lsn = new IO::Socket::INET(Listen => 1, LocalPort => 8080); $sel = new IO::Select( $lsn ); while(@ready = $sel->can_read) { ... }
  • Comment on Re: What is the easy way to check if the socket has data to read, before do a read()
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-24 06:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found