use IO::Select (); my $sel = IO::Select->new($MySocket); my @read = $sel->can_read(3) or die("Time out!\n"); $MySocket->recv($text);