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
In reply to how to unblocking with thread? by mr.red
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |