Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: IO::Socket Listen

by Eliya (Vicar)
on Dec 05, 2011 at 20:11 UTC ( #941912=note: print w/ replies, xml ) Need Help??


in reply to Re^2: IO::Socket Listen
in thread IO::Socket Listen

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 $_; }


Comment on Re^3: IO::Socket Listen
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://941912]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2015-07-29 08:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (261 votes), past polls