You don't need to set the socket to non-blocking if you use select just
for reading (and I just checked our codebase at work---I don't set any of
the sockets to nonblocking).
All select() does is indicate when a file
descriptor (in your case, a network socket) has received data (ready for
reading), can write data without blocking (ready for writing ) or an
> Isn't there any clean way to have the coroutine associated with the socket
> to somehow keep running in background without being continuously
> interrupted ?
Lua coroutines are not threads as they don't run autonomously but need to
be explicitely scheduled (or resumed). I have sample Lua code that does
this, but it uses my own network  and select  modules, not luasocket
. If you are interested, I can send the code which may help you with