When reading from a IO::Socket::INET filehandle it can not be assumed that there will always be data available on the stream. What techniques are available to either peek at the stream to check if data is available or when doing the read take no data without a valid line termination and immediately pass through the read?
views:
128answers:
2
+6
A:
Set the Blocking
option to 0
when creating the socket:
$sock = IO::Socket::INET->new(Blocking => 0, ...);
Robert Gamble
2008-11-24 22:36:58
File this one under 'RTFD... correctly'
Erick
2008-11-24 22:42:48
+2
A:
Checkout IO::Select; it's very often what I end up using when handling sockets in a non-blocking way.
Gilimanjaro
2008-11-25 14:44:25