How to make a non-blocking recv from perl socket
When making a recv call on a TCP socket and when it turns out that the recv call is开发者_如何学运维 blocking even though the socket itself was set up in non-blocking mode, how does one implement a non-blocking recv on the perl socket?
If your looking for a simpler interface to select
mentioned by mobrule IO::Select provides an OO interface to it.
Use the 4 argument version of select
to check whether there is input on the socket before you try to recv
from it.
Try passing the MSG_DONTWAIT
flag to your recv
call.
精彩评论