I make a recv call on a TCP socket and it tured out to be that the recv call is a blocking one even though the socket itself has set to be in non-blocking mode. So my question is just as simple as: how to implement a non-blocking recv on a perl socket? thanks in advance.
A:
DaMartyr
2010-06-18 02:47:34
+2
A:
Use the 4 argument version of select
to check whether there is input on the socket before you try to recv
from it.
mobrule
2010-06-18 04:11:08
+3
A:
If your looking for a simpler interface to select
mentioned by mobrule IO::Select provides an OO interface to it.
Ven'Tatsu
2010-06-18 18:04:27
IO::Socket provides some nice API cleanup as well. I always use IO::Select and IO::Socket instead of the built-in functions. The API is a million times easier to work with.
daotoad
2010-06-19 04:29:26
Thanks, it worked great for me too.
Igor Oks
2010-08-09 11:55:07