Hi,
On 7/9/07, Peter Gordon <[EMAIL PROTECTED]> wrote:
> If IO::All is not suitable, what is the best way of setting unblocking
> mode.
not sure it is the best way, but it may be good for you:
use IO::Socket;
use IO::Pool qw( POLLIN POLLOUT );
my $socketout1 = new IO::Socket::INET ("$host1:$port");
my $socketin1 = new IO::Socket::INET ("$host2:$port");
$socketout1->blocking(0);
$socketin1->blocking(0);
my $poll = new IO::Poll;
$poll->mask( $socketout1, POLLOUT );
$poll->mask( $socketin1, POLLIN );
while ( $poll->handles ) {
$poll->poll;
my @readers = $poll->handles( POLLIN );
my @writers = $poll->handles( POLLOUT );
procReader( $_ ) foreach @readers;
procWriter( $_ ) foreach @writers;
}
#########################
thanks
Pinkhas Nisanov
_______________________________________________
Perl mailing list
[email protected]
http://perl.org.il/mailman/listinfo/perl