mr.red has asked for the wisdom of the Perl Monks concerning the following question:
hello; i write this code ; but blocked by this line : "$con2->getline" ; how to unblocking ?? #'//-------------------------------------------
use IO::Socket::INET ; use Thread ; $|++; $t = IO::Socket::INET->new( LocalAddr => "localhost", LocalPort => 90 , Listen => 1 ); $con = $t->accept(); Thread->new(\&reader_stream , $con); while(1){ $get = <STDIN> ; chomp($get); $con->autoflush(1); $con->send($get); } sub reader_stream { my $con2 = shift ; while(defined(my $recive = $con2->getline)){ print $recive."\n" ; } } close $t;
#'//------------------- thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to unblocking with thread?
by Monkomatic (Sexton) on Feb 22, 2011 at 18:21 UTC | |
by Marshall (Canon) on Feb 22, 2011 at 18:34 UTC |