When you know the length of the expected response (such as 131), you can concat the pieces you get from sysread and check if the resulting string has reached that length. I said "pieces" because in theory (for example, if the connection has temporarily stalled for some reason), sysread might return prematurely with less than the requested number of bytes. So, to be sure, you'd need some loop + concat:
my $len = 131; my $resp = ''; while ( sysread $socket, $_, $len ) { $repsp .= $_; last if length($resp) >= $len; }
In reply to Re^7: IO::Socket Listen
by Eliya
in thread IO::Socket Listen
by Secalles
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |