From man IO::Select:
Here is a short example which shows how `IO::Select' could be used to write a server which communicates with several sockets while also listening for more connections on a listen socketuse IO::Select; use IO::Socket; $lsn = new IO::Socket::INET(Listen => 1, LocalPort => 8080) +; $sel = new IO::Select( $lsn ); while(@ready = $sel->can_read) { foreach $fh (@ready) { if($fh == $lsn) { # Create a new socket $new = $lsn->accept; $sel->add($new); } else { # Process socket # Maybe we have finished with the socket $sel->remove($fh); $fh->close; } } }
After Compline,
Zaxo
In reply to Re: bidirectional IPC (Linux)
by Zaxo
in thread bidirectional IPC (Linux)
by Mirage
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |