but this program takes 5 minutes to respond
The problem probably is that the device isn't sending a newline, so the <$sock> (i.e. readline) keeps waiting for it until the socket is finally closed — which is likely what is happening due to a timeout after those 5 minutes...
Try sysread instead (with a length value larger than the response you expect).
while ( sysread $sock, $_, 1000 ) { print $_; }
In reply to Re^3: IO::Socket Listen
by Eliya
in thread IO::Socket Listen
by Secalles
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |